summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2011-01-18 21:27:35 +0000
committermichi_cc <michi_cc@openttd.org>2011-01-18 21:27:35 +0000
commit5f285916100bea2ee28ca3d8680f5bc2c99fa942 (patch)
treea4161965eec4a4227d057ea45b34a09c509e3ad7
parent73da045f50ac7aa67ad9330e4671f1d49c6c340c (diff)
downloadopenttd-5f285916100bea2ee28ca3d8680f5bc2c99fa942.tar.xz
(svn r21840) -Change: Support tags created by hgsubversion for the revision detection.
-rwxr-xr-xfindversion.sh5
-rwxr-xr-xprojects/determineversion.vbs17
2 files changed, 20 insertions, 2 deletions
diff --git a/findversion.sh b/findversion.sh
index 94e48413e..2e542cae4 100755
--- a/findversion.sh
+++ b/findversion.sh
@@ -112,6 +112,11 @@ elif [ -d "$ROOT_DIR/.hg" ]; then
HASH=`LC_ALL=C hg id -i | cut -c1-12`
REV="h`echo $HASH | cut -c1-8`"
BRANCH=`hg branch | sed 's@^default$@@'`
+ TAG=`hg id -t`
+ if [ -n "$TAG" ] && [ $TAG != "tip" ]; then
+ BRANCH=""
+ REV=$TAG
+ fi
REV_NR=`LC_ALL=C hg log -f -k "(svn r" -l 1 --template "{desc}\n" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
# We are an exported source bundle
diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs
index 872ff7b0a..9b159785c 100755
--- a/projects/determineversion.vbs
+++ b/projects/determineversion.vbs
@@ -237,7 +237,7 @@ Function DetermineSVNVersion()
If version = "norev000" Then
' git detection failed, reset error and try mercurial (hg)
Err.Clear
- Set oExec = WshShell.Exec("hg parents")
+ Set oExec = WshShell.Exec("hg id -i")
If Err.Number = 0 Then
' Wait till the application is finished ...
Do While oExec.Status = 0
@@ -245,8 +245,21 @@ Function DetermineSVNVersion()
If oExec.ExitCode = 0 Then
line = OExec.StdOut.ReadLine()
- hash = Mid(line, InStrRev(line, ":") + 1)
+ hash = Left(line, 12)
version = "h" & Mid(hash, 1, 8)
+
+ ' Check if a tag is currently checked out
+ Err.Clear
+ Set oExec = WshShell.Exec("hg id -t")
+ If Err.Number = 0 Then
+ line = oExec.StdOut.ReadLine()
+ If Len(line) > 0 And line <> "tip" Then
+ version = line
+ branch = ""
+ End If ' Len(line) > 0 And line <> "tip"
+ End If ' Err.Number = 0
+
+ Err.Clear
Set oExec = WshShell.Exec("hg status ../")
If Err.Number = 0 Then
Do