Commits

Takayuki KONDO committed 6b675ae

improve get-hg-version (getHgVer function)

Comments (0)

Files changed (1)

get-hg-version.sh

 #!/bin/bash
 # -*- coding:sjis-unix -*-
 
-ARCH=$(uname -s)-$(uname -m)
+function getHgVer
+{
+    ARCH=$(uname -s)-$(uname -m)
 
-if [[ $ARCH = MINGW* ]]; then
-    export LANGUAGE=C
-else
-    export LANG=C
-fi
-hg version -q
+    if [[ $ARCH = MINGW* ]]; then
+		export LANGUAGE=C
+    else
+		export LANG=C
+    fi
+
+    TMP=/tmp/tmp.hg.ver.$$
+    hg version -q > $TMP
+    
+    VER=`sed -e 's/Mercurial Distributed SCM (version \(.*\))/\1/' $TMP`
+    rm $TMP
+	
+	echo $VER		# string of hg version
+}
+
+HGVER=`getHgVer`
+echo $HGVER
+