1
0
Fork 0

(svn r20308) -Change: don't only look at only the src directory for the revision, but at the parent of the src directory.

release/1.1
rubidium 2010-08-02 16:38:26 +00:00
parent 6371e6c4db
commit e8dc701cc4
2 changed files with 17 additions and 18 deletions

View File

@ -66,20 +66,19 @@ fi
# Find out some dirs # Find out some dirs
cd `dirname "$0"` cd `dirname "$0"`
ROOT_DIR=`pwd` ROOT_DIR=`pwd`
SRC_DIR=src
# Determine if we are using a modified version # Determine if we are using a modified version
# Assume the dir is not modified # Assume the dir is not modified
MODIFIED="0" MODIFIED="0"
if [ -d "$ROOT_DIR/.svn" ]; then if [ -d "$ROOT_DIR/.svn" ]; then
# We are an svn checkout # We are an svn checkout
if [ -n "`svnversion \"$SRC_DIR\" | grep 'M'`" ]; then if [ -n "`svnversion | grep 'M'`" ]; then
MODIFIED="2" MODIFIED="2"
fi fi
# Find the revision like: rXXXXM-branch # Find the revision like: rXXXXM-branch
BRANCH=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^URL:.*branches/ { split($2, a, "/"); for(i in a) if (a[i]=="branches") { print a[i+1]; break } }'` BRANCH=`LC_ALL=C svn info | "$AWK" '/^URL:.*branches/ { split($2, a, "/"); for(i in a) if (a[i]=="branches") { print a[i+1]; break } }'`
TAG=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^URL:.*tags/ { split($2, a, "/"); for(i in a) if (a[i]=="tags") { print a[i+1]; break } }'` TAG=`LC_ALL=C svn info | "$AWK" '/^URL:.*tags/ { split($2, a, "/"); for(i in a) if (a[i]=="tags") { print a[i+1]; break } }'`
REV_NR=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^Last Changed Rev:/ { print $4 }'` REV_NR=`LC_ALL=C svn info | "$AWK" '/^Last Changed Rev:/ { print $4 }'`
if [ -n "$TAG" ]; then if [ -n "$TAG" ]; then
REV=$TAG REV=$TAG
else else
@ -89,26 +88,26 @@ elif [ -d "$ROOT_DIR/.git" ]; then
# We are a git checkout # We are a git checkout
# Refresh the index to make sure file stat info is in sync, then look for modifications # Refresh the index to make sure file stat info is in sync, then look for modifications
git update-index --refresh >/dev/null git update-index --refresh >/dev/null
if [ -n "`git diff-index HEAD \"$SRC_DIR\"`" ]; then if [ -n "`git diff-index HEAD`" ]; then
MODIFIED="2" MODIFIED="2"
fi fi
HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null` HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`
REV="g`echo $HASH | cut -c1-8`" REV="g`echo $HASH | cut -c1-8`"
BRANCH=`git symbolic-ref -q HEAD 2>/dev/null | sed 's@.*/@@;s@^master$@@'` BRANCH=`git symbolic-ref -q HEAD 2>/dev/null | sed 's@.*/@@;s@^master$@@'`
REV_NR=`LC_ALL=C git log --pretty=format:%s --grep="^(svn r[0-9]*)" -1 -- "$SRC_DIR" | sed "s@.*(svn r\([0-9]*\)).*@\1@"` REV_NR=`LC_ALL=C git log --pretty=format:%s --grep="^(svn r[0-9]*)" -1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
if [ -z "$REV_NR" ]; then if [ -z "$REV_NR" ]; then
# No rev? Maybe it is a custom git-svn clone # 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 -- "$SRC_DIR" | sed "s@.*\@\([0-9]*\).*@\1@"` REV_NR=`LC_ALL=C git log --pretty=format:%b --grep="git-svn-id:.*@[0-9]*" -1 | sed "s@.*\@\([0-9]*\).*@\1@"`
fi fi
elif [ -d "$ROOT_DIR/.hg" ]; then elif [ -d "$ROOT_DIR/.hg" ]; then
# We are a hg checkout # We are a hg checkout
if [ -n "`hg status \"$SRC_DIR\" | grep -v '^?'`" ]; then if [ -n "`hg status | grep -v '^?'`" ]; then
MODIFIED="2" MODIFIED="2"
fi fi
HASH=`LC_ALL=C hg id -i | cut -c1-12` HASH=`LC_ALL=C hg id -i | cut -c1-12`
REV="h`echo $HASH | cut -c1-8`" REV="h`echo $HASH | cut -c1-8`"
BRANCH=`hg branch | sed 's@^default$@@'` BRANCH=`hg branch | sed 's@^default$@@'`
REV_NR=`LC_ALL=C hg log -r $HASH:0 -k "svn" -l 1 --template "{desc}\n" "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"` REV_NR=`LC_ALL=C hg log -r $HASH:0 -k "svn" -l 1 --template "{desc}\n" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
else else
# We don't know # We don't know
MODIFIED="1" MODIFIED="1"

View File

@ -105,7 +105,7 @@ Function DetermineSVNVersion()
If sTortoise <> "" Then If sTortoise <> "" Then
Dim SubWCRev Dim SubWCRev
Set SubWCRev = WScript.CreateObject("SubWCRev.object") Set SubWCRev = WScript.CreateObject("SubWCRev.object")
SubWCRev.GetWCInfo FSO.GetAbsolutePathName("../src"), 0, 0 SubWCRev.GetWCInfo FSO.GetAbsolutePathName("../"), 0, 0
revision = SubWCRev.Revision revision = SubWCRev.Revision
version = "r" & revision version = "r" & revision
modified = 0 modified = 0
@ -124,7 +124,7 @@ Function DetermineSVNVersion()
WshShell.Environment("PROCESS")("LANG") = "en" WshShell.Environment("PROCESS")("LANG") = "en"
' Do we have subversion installed? Check immediatelly whether we've got a modified WC. ' Do we have subversion installed? Check immediatelly whether we've got a modified WC.
Set oExec = WshShell.Exec("svnversion ../src") Set oExec = WshShell.Exec("svnversion ../")
If Err.Number = 0 Then If Err.Number = 0 Then
' Wait till the application is finished ... ' Wait till the application is finished ...
Do While oExec.Status = 0 Do While oExec.Status = 0
@ -137,7 +137,7 @@ Function DetermineSVNVersion()
End If End If
' And use svn info to get the correct revision and branch information. ' And use svn info to get the correct revision and branch information.
Set oExec = WshShell.Exec("svn info ../src") Set oExec = WshShell.Exec("svn info ../")
If Err.Number = 0 Then If Err.Number = 0 Then
Do Do
line = OExec.StdOut.ReadLine() line = OExec.StdOut.ReadLine()
@ -179,7 +179,7 @@ Function DetermineSVNVersion()
WScript.Sleep 10 WScript.Sleep 10
Loop Loop
End If End If
Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../src") Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../")
If Err.Number = 0 Then If Err.Number = 0 Then
' Wait till the application is finished ... ' Wait till the application is finished ...
Do While oExec.Status = 0 Do While oExec.Status = 0
@ -198,7 +198,7 @@ Function DetermineSVNVersion()
End If ' line <> "master" End If ' line <> "master"
End If ' Err.Number = 0 End If ' Err.Number = 0
Set oExec = WshShell.Exec("git log --pretty=format:%s --grep=" & Chr(34) & "^(svn r[0-9]*)" & Chr(34) & " -1 ../src") Set oExec = WshShell.Exec("git log --pretty=format:%s --grep=" & Chr(34) & "^(svn r[0-9]*)" & Chr(34) & " -1 ../")
if Err.Number = 0 Then if Err.Number = 0 Then
revision = Mid(oExec.StdOut.ReadLine(), 7) revision = Mid(oExec.StdOut.ReadLine(), 7)
revision = Mid(revision, 1, InStr(revision, ")") - 1) revision = Mid(revision, 1, InStr(revision, ")") - 1)
@ -207,7 +207,7 @@ Function DetermineSVNVersion()
' No revision? Maybe it is a custom git-svn clone ' No revision? Maybe it is a custom git-svn clone
' Reset error number as WshShell.Exec will not do that on success ' Reset error number as WshShell.Exec will not do that on success
Err.Clear Err.Clear
Set oExec = WshShell.Exec("git log --pretty=format:%b --grep=" & Chr(34) & "git-svn-id:.*@[0-9]*" & Chr(34) & " -1 ../src") 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 If Err.Number = 0 Then
revision = oExec.StdOut.ReadLine() revision = oExec.StdOut.ReadLine()
revision = Mid(revision, InStr(revision, "@") + 1) revision = Mid(revision, InStr(revision, "@") + 1)
@ -231,7 +231,7 @@ Function DetermineSVNVersion()
line = OExec.StdOut.ReadLine() line = OExec.StdOut.ReadLine()
hash = Mid(line, InStrRev(line, ":") + 1) hash = Mid(line, InStrRev(line, ":") + 1)
version = "h" & Mid(hash, 1, 8) version = "h" & Mid(hash, 1, 8)
Set oExec = WshShell.Exec("hg status ../src") Set oExec = WshShell.Exec("hg status ../")
If Err.Number = 0 Then If Err.Number = 0 Then
Do Do
line = OExec.StdOut.ReadLine() line = OExec.StdOut.ReadLine()
@ -249,7 +249,7 @@ Function DetermineSVNVersion()
End If ' line <> "default" End If ' line <> "default"
End If ' Err.Number = 0 End If ' Err.Number = 0
Set oExec = WshShell.Exec("hg log -r " & hash & ":0 -k " & Chr(34) & "svn" & Chr(34) & " -l 1 --template " & Chr(34) & "{desc}\n" & Chr(34) & " ../src") Set oExec = WshShell.Exec("hg log -r " & hash & ":0 -k " & Chr(34) & "svn" & Chr(34) & " -l 1 --template " & Chr(34) & "{desc}\n" & Chr(34) & " ../")
If Err.Number = 0 Then If Err.Number = 0 Then
revision = Mid(OExec.StdOut.ReadLine(), 7) revision = Mid(OExec.StdOut.ReadLine(), 7)
revision = Mid(revision, 1, InStr(revision, ")") - 1) revision = Mid(revision, 1, InStr(revision, ")") - 1)