summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-03-16 18:45:06 -0700
committerRuss Cox <rsc@golang.org>2010-03-16 18:45:06 -0700
commit7a3fec972619131844fdef0681d4e187d9126858 (patch)
tree608c4d1a7d53ebbde89fa39200a45e7618825fe0
parentc565bdefd5f9c7d1f1ab7592f3f98dcbe5215f77 (diff)
downloadgolang-7a3fec972619131844fdef0681d4e187d9126858.tar.gz
version.bash: cope with ancient Mercurial
R=adg CC=dpx, golang-dev http://codereview.appspot.com/593043
-rwxr-xr-xsrc/version.bash10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/version.bash b/src/version.bash
index c2a70ac1f..2d29825ff 100755
--- a/src/version.bash
+++ b/src/version.bash
@@ -10,10 +10,16 @@ if ! hg version > /dev/null 2>&1; then
fi
# Get numerical revision
-VERSION="`hg identify -n`"
+VERSION=$(hg identify -n 2>/dev/null)
+if [ $? = 0 ]; then
+ TAG=$(hg identify -t | sed 's!/release!!')
+else
+ OLD=$(hg identify | sed 1q)
+ VERSION=$(echo $OLD | awk '{print $1}')
+ TAG=$(echo $OLD | awk '{print $2}' | sed 's!/release!!')
+fi
# Append tag if not 'tip'
-TAG=$(hg identify -t | sed 's!/release!!')
if [[ "$TAG" != "tip" ]]; then
VERSION="$VERSION $TAG"
fi