]> Cypherpunks repositories - gostls13.git/commitdiff
version.bash: cope with ancient Mercurial
authorRuss Cox <rsc@golang.org>
Wed, 17 Mar 2010 01:45:06 +0000 (18:45 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 17 Mar 2010 01:45:06 +0000 (18:45 -0700)
R=adg
CC=dpx, golang-dev
https://golang.org/cl/593043

src/version.bash

index c2a70ac1f7813b789f5b8dc39cd029ee96e29a32..2d29825ff9130c5b55007e5552646b8c5d17e25d 100755 (executable)
@@ -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