# HG changeset patch # User michi_cc # Date 2011-01-18 21:27:30 # Node ID 68ea7f31e57c844b779115f94a1847d343cb8dc1 # Parent 91a5bff32f6ccdb63a322c7980318b3a9eaf7cf2 (svn r21839) -Change: Support tags created by git-svn for the revision detection. diff --git a/findversion.sh b/findversion.sh --- a/findversion.sh +++ b/findversion.sh @@ -99,6 +99,11 @@ elif [ -d "$ROOT_DIR/.git" ]; then # No rev? Maybe it is a custom git-svn clone REV_NR=`LC_ALL=C git log --pretty=format:%b --grep="git-svn-id:.*@[0-9]*" -1 | sed "s@.*\@\([0-9]*\).*@\1@"` fi + TAG=`git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null` + if [ -n "$TAG" ]; then + BRANCH="" + REV=$TAG + fi elif [ -d "$ROOT_DIR/.hg" ]; then # We are a hg checkout if [ -n "`hg status | grep -v '^?'`" ]; then diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs --- a/projects/determineversion.vbs +++ b/projects/determineversion.vbs @@ -201,7 +201,7 @@ Function DetermineSVNVersion() End If ' line <> "master" End If ' Err.Number = 0 - Set oExec = WshShell.Exec("git log --pretty=format:%s --grep=" & Chr(34) & "^(svn r[0-9]*)" & Chr(34) & " -1 ../") + Set oExec = WshShell.Exec("git log --pretty=format:%s --grep=" & Chr(34) & "^(svn r[0-9]*)" & Chr(34) & " -1") if Err.Number = 0 Then revision = Mid(oExec.StdOut.ReadLine(), 7) revision = Mid(revision, 1, InStr(revision, ")") - 1) @@ -210,13 +210,26 @@ Function DetermineSVNVersion() ' No revision? Maybe it is a custom git-svn clone ' Reset error number as WshShell.Exec will not do that on success Err.Clear - Set oExec = WshShell.Exec("git log --pretty=format:%b --grep=" & Chr(34) & "git-svn-id:.*@[0-9]*" & Chr(34) & " -1 ../") + Set oExec = WshShell.Exec("git log --pretty=format:%b --grep=" & Chr(34) & "git-svn-id:.*@[0-9]*" & Chr(34) & " -1") If Err.Number = 0 Then revision = oExec.StdOut.ReadLine() revision = Mid(revision, InStr(revision, "@") + 1) revision = Mid(revision, 1, InStr(revision, " ") - 1) End If ' Err.Number = 0 End If ' revision = "" + + ' Check if a tag is currently checked out + Err.Clear + Set oExec = WshShell.Exec("git name-rev --name-only --tags --no-undefined HEAD") + If Err.Number = 0 Then + ' Wait till the application is finished ... + Do While oExec.Status = 0 + Loop + If oExec.ExitCode = 0 Then + version = oExec.StdOut.ReadLine() + branch = "" + End If ' oExec.ExitCode = 0 + End If ' Err.Number = 0 End If ' Err.Number = 0 End If ' oExec.ExitCode = 0 End If ' Err.Number = 0