(svn r14194) -Fix: don't use hardcoded character offsets to get hg revision. This make it similar to svn and git (ie without the ':').
authorglx
Sat, 30 Aug 2008 13:15:36 +0000
changeset 10035 9e6d49966bf5
parent 10034 31baa7c207b8
child 10036 5c28389c3eeb
(svn r14194) -Fix: don't use hardcoded character offsets to get hg revision. This make it similar to svn and git (ie without the ':').
Makefile.src.in
projects/determineversion.vbs
--- a/Makefile.src.in	Sat Aug 30 12:14:56 2008 +0000
+++ b/Makefile.src.in	Sat Aug 30 13:15:36 2008 +0000
@@ -123,7 +123,7 @@
 # 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 @@
 # 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
--- a/projects/determineversion.vbs	Sat Aug 30 12:14:56 2008 +0000
+++ b/projects/determineversion.vbs	Sat Aug 30 13:15:36 2008 +0000
@@ -199,7 +199,7 @@
 			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 @@
 				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