diff --git a/findversion.sh b/findversion.sh --- 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 --- 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