[llvm-commits] [llvm] r94077 - /llvm/trunk/utils/GetSourceVersion

Daniel Dunbar daniel at zuster.org
Thu Jan 21 08:10:01 PST 2010


Author: ddunbar
Date: Thu Jan 21 10:09:59 2010
New Revision: 94077

URL: http://llvm.org/viewvc/llvm-project?rev=94077&view=rev
Log:
Add a simple script for getting a version tag from a svn/git-svn/git
repository. Feel free to add support for your favorite VCS.

Added:
    llvm/trunk/utils/GetSourceVersion   (with props)

Added: llvm/trunk/utils/GetSourceVersion
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/GetSourceVersion?rev=94077&view=auto

==============================================================================
--- llvm/trunk/utils/GetSourceVersion (added)
+++ llvm/trunk/utils/GetSourceVersion Thu Jan 21 10:09:59 2010
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+function usage() {
+   echo "usage: $0 <source root>"
+   echo "  Prints the source control revision of the given source directory,"
+   echo "  the exact format of the revision string depends on the source "
+   echo "  control system. If the source control system isn't known, the output"
+   echo "  is empty and the exit code is 1."
+   exit 1
+}
+
+if [ $# != 1 ] || [ ! -d $1 ]; then
+  usage;
+fi
+
+cd $1
+if [ -d .svn ]; then
+   svnversion
+elif [ -d .git/svn ]; then
+   git svn info | grep 'Revision:' | cut -d: -f2-
+elif [ -d .git ]; then
+   git log -1 --pretty=format:%H
+else
+   exit 1;
+fi
+
+exit 0

Propchange: llvm/trunk/utils/GetSourceVersion

------------------------------------------------------------------------------
    svn:executable = *





More information about the llvm-commits mailing list