Changeset - r17109:1d6a7e911128
[Not reviewed]
master
0 2 0
michi_cc - 14 years ago 2011-01-19 17:10:52
michi_cc@openttd.org
(svn r21856) -Fix (r21840): Don't fail tag detection on hg repositories that use mercurial queues. Add some safety against tags and branches with spaces as well.
2 files changed with 9 insertions and 9 deletions:
0 comments (0 inline, 0 general)
findversion.sh
Show inline comments
 
@@ -84,47 +84,47 @@ if [ -d "$ROOT_DIR/.svn" ]; then
 
	else
 
		REV="r$REV_NR"
 
	fi
 
elif [ -d "$ROOT_DIR/.git" ]; then
 
	# We are a git checkout
 
	# Refresh the index to make sure file stat info is in sync, then look for modifications
 
	git update-index --refresh >/dev/null
 
	if [ -n "`git diff-index HEAD`" ]; then
 
		MODIFIED="2"
 
	fi
 
	HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`
 
	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 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
 
	if [ -z "$REV_NR" ]; 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`
 
	TAG="`git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null`"
 
	if [ -n "$TAG" ]; then
 
		BRANCH=""
 
		REV=$TAG
 
		REV="$TAG"
 
	fi
 
elif [ -d "$ROOT_DIR/.hg" ]; then
 
	# We are a hg checkout
 
	if [ -n "`hg status | grep -v '^?'`" ]; then
 
		MODIFIED="2"
 
	fi
 
	HASH=`LC_ALL=C hg id -i | cut -c1-12`
 
	REV="h`echo $HASH | cut -c1-8`"
 
	BRANCH=`hg branch | sed 's@^default$@@'`
 
	TAG=`hg id -t`
 
	if [ -n "$TAG" ] && [ $TAG != "tip" ]; then
 
	BRANCH="`hg branch | sed 's@^default$@@'`"
 
	TAG="`hg id -t | grep -v 'tip$'`"
 
	if [ -n "$TAG" ]; then
 
		BRANCH=""
 
		REV=$TAG
 
		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@"`
 
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
 
	# We are an exported source bundle
 
	cat $ROOT_DIR/.ottdrev
 
	exit
 
else
 
	# We don't know
 
	MODIFIED="1"
 
	BRANCH=""
 
	REV=""
 
	REV_NR=""
projects/determineversion.vbs
Show inline comments
 
@@ -244,28 +244,28 @@ Function DetermineSVNVersion()
 
				Loop
 

	
 
				If oExec.ExitCode = 0 Then
 
					line = OExec.StdOut.ReadLine()
 
					hash = Left(line, 12)
 
					version = "h" & Mid(hash, 1, 8)
 

	
 
					' Check if a tag is currently checked out
 
					Err.Clear
 
					Set oExec = WshShell.Exec("hg id -t")
 
					If Err.Number = 0 Then
 
						line = oExec.StdOut.ReadLine()
 
						If Len(line) > 0 And line <> "tip" Then
 
						If Len(line) > 0 And Right(line, 3) <> "tip" Then
 
							version = line
 
							branch = ""
 
						End If ' Len(line) > 0 And line <> "tip"
 
						End If ' Len(line) > 0 And Right(line, 3) <> "tip"
 
					End If ' Err.Number = 0
 

	
 
					Err.Clear
 
					Set oExec = WshShell.Exec("hg status ../")
 
					If Err.Number = 0 Then
 
						Do
 
							line = OExec.StdOut.ReadLine()
 
							If Len(line) > 0 And Mid(line, 1, 1) <> "?" Then
 
								modified = 2
 
								Exit Do
 
							End If ' Len(line) > 0 And Mid(line, 1, 1) <> "?"
 
						Loop While Not OExec.StdOut.atEndOfStream
0 comments (0 inline, 0 general)