Mercurial > hg > openttd
changeset 17120:28b86b282635 draft
(svn r21857) -Add: Revision detection for hgsubversion repositories.
author | michi_cc <michi_cc@openttd.org> |
---|---|
date | Wed, 19 Jan 2011 17:10:57 +0000 |
parents | 342dacb475e6 |
children | 325d6c9a9817 |
files | findversion.sh projects/determineversion.vbs |
diffstat | 2 files changed, 20 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/findversion.sh +++ b/findversion.sh @@ -117,7 +117,11 @@ 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
--- a/projects/determineversion.vbs +++ b/projects/determineversion.vbs @@ -278,11 +278,23 @@ 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