summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2011-01-19 17:10:57 +0000
committermichi_cc <michi_cc@openttd.org>2011-01-19 17:10:57 +0000
commit10a7678beb83801daed3aaf5b14b715afc4d52e3 (patch)
treeb3c8ed231239831266b70a26063adc5b36db5ad9
parent22922414eb3d37a35c4446de39db52420ab2f05d (diff)
downloadopenttd-10a7678beb83801daed3aaf5b14b715afc4d52e3.tar.xz
(svn r21857) -Add: Revision detection for hgsubversion repositories.
-rwxr-xr-xfindversion.sh6
-rwxr-xr-xprojects/determineversion.vbs18
2 files changed, 20 insertions, 4 deletions
diff --git a/findversion.sh b/findversion.sh
index 3c935538c..e83a6c0bf 100755
--- a/findversion.sh
+++ b/findversion.sh
@@ -117,7 +117,11 @@ elif [ -d "$ROOT_DIR/.hg" ]; 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@"`
+ REV_NR=`LC_ALL=C hg log -f -k "(svn r" -l 1 --template "{desc|firstline}\n" | grep "^(svn r[0-9]*)" | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
+ if [ -z "$REV_NR" ]; then
+ # No rev? Maybe it is a custom hgsubversion clone
+ REV_NR=`LC_ALL=C hg parent --template="{svnrev}"`
+ fi
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
# We are an exported source bundle
cat $ROOT_DIR/.ottdrev
diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs
index 097282bfd..8a991b40e 100755
--- a/projects/determineversion.vbs
+++ b/projects/determineversion.vbs
@@ -278,11 +278,23 @@ Function DetermineSVNVersion()
End If ' line <> "default"
End If ' Err.Number = 0
- Set oExec = WshShell.Exec("hg log -f -k " & Chr(34) & "(svn r" & Chr(34) & " -l 1 --template " & Chr(34) & "{desc}\n" & Chr(34) & " --cwd ../")
+ Set oExec = WshShell.Exec("hg log -f -k " & Chr(34) & "(svn r" & Chr(34) & " -l 1 --template " & Chr(34) & "{desc|firstline}\n" & Chr(34) & " --cwd ../")
If Err.Number = 0 Then
- revision = Mid(OExec.StdOut.ReadLine(), 7)
- revision = Mid(revision, 1, InStr(revision, ")") - 1)
+ line = oExec.StdOut.ReadLine()
+ If Left(line, 6) = "(svn r" Then
+ revision = Mid(line, 7)
+ revision = Mid(revision, 1, InStr(revision, ")") - 1)
+ End If 'Left(line, 6) = "(svn r"
End If ' Err.Number = 0
+
+ If revision = "" Then
+ ' No rev? Maybe it is a custom hgsubversion clone
+ Err.Clear
+ Set oExec = WshShell.Exec("hg parent --template=" & Chr(34) & "{svnrev}" & Chr(34))
+ If Err.Number = 0 Then
+ revision = oExec.StdOut.ReadLine()
+ End If ' Err.Number = 0
+ End If ' revision = ""
End If ' Err.Number = 0
End If ' oExec.ExitCode = 0
End If ' Err.Number = 0