summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-08-30 13:15:36 +0000
committerglx <glx@openttd.org>2008-08-30 13:15:36 +0000
commit01ce633a93a4238d9cf9ae9bc915f01a3a37d0a6 (patch)
tree9e11a6a5e60837148cbd6c8d1fec9dd1f005cba3
parent17998f7f98209ec0c641a87a7ab4ae5925a75936 (diff)
downloadopenttd-01ce633a93a4238d9cf9ae9bc915f01a3a37d0a6.tar.xz
(svn r14194) -Fix: don't use hardcoded character offsets to get hg revision. This make it similar to svn and git (ie without the ':').
-rw-r--r--Makefile.src.in4
-rwxr-xr-xprojects/determineversion.vbs5
2 files changed, 5 insertions, 4 deletions
diff --git a/Makefile.src.in b/Makefile.src.in
index 868db8850..d2b83fcf8 100644
--- a/Makefile.src.in
+++ b/Makefile.src.in
@@ -123,7 +123,7 @@ else
# Are we a SVN dir?
ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
# Find if the local source if modified
-# Find the revision like: rXXXX-branch
+# Find the revision like: rXXXXM-branch
REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branches/ { split($$2, a, "/"); for(i in a) if (a[i]=="branches") { BRANCH="-"a[i+1]; break } } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
REV_NR := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^Last Changed Rev:/ { print $$4 }')
else
@@ -136,7 +136,7 @@ else
# Are we a hg (Mercurial) dir?
ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
# Find the revision like: hXXXXM-branch
-REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -c19-26; fi)$(REV_MODIFIED)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
+REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -d: -f3 | cut -c1-8; fi)$(REV_MODIFIED)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
REV_NR := $(shell LC_ALL=C hg log -k "svn" -l 1 --template "{desc}\n" $(SRC_DIR) | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
endif
endif
diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs
index 896d3e5e0..2920e958d 100755
--- a/projects/determineversion.vbs
+++ b/projects/determineversion.vbs
@@ -199,7 +199,7 @@ Function DetermineSVNVersion()
Set oExec = WshShell.Exec("git symbolic-ref HEAD")
If Err.Number = 0 Then
line = oExec.StdOut.ReadLine()
- line = Mid(line, InStrRev(line, "/")+1)
+ line = Mid(line, InStrRev(line, "/") + 1)
If line <> "master" Then
version = version & "-" & line
End If
@@ -214,7 +214,8 @@ Function DetermineSVNVersion()
Loop
End If
If Err.Number = 0 And oExec.ExitCode = 0 Then
- version = "h" & Mid(OExec.StdOut.ReadLine(), 19, 8)
+ line = OExec.StdOut.ReadLine()
+ version = "h" & Mid(line, InStrRev(line, ":") + 1, 8)
Set oExec = WshShell.Exec("hg status ../src")
If Err.Number = 0 Then
Do