Changeset - r15638:dcccc7b23ed3
[Not reviewed]
master
0 1 0
rubidium - 14 years ago 2010-08-02 18:37:37
rubidium@openttd.org
(svn r20313) -Fix (r20309): Mercurial version detection picked up a bit more than it should've picked up.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
findversion.sh
Show inline comments
 
@@ -86,44 +86,44 @@ if [ -d "$ROOT_DIR/.svn" ]; then
 
	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$@@'`
 
	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
 
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$@@'`
 
	REV_NR=`LC_ALL=C hg log -f -k "(svn r" -l 1 --template "{desc}\n" | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
 
	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@"`
 
else
 
	# We don't know
 
	MODIFIED="1"
 
	BRANCH=""
 
	REV=""
 
	REV_NR=""
 
fi
 

	
 
if [ "$MODIFIED" -eq "2" ]; then
 
	REV="${REV}M"
 
fi
 

	
 
CLEAN_REV=${REV}
 

	
 
if [ -n "$BRANCH" ]; then
 
	REV="${REV}-$BRANCH"
 
fi
 

	
 
echo "$REV	$REV_NR	$MODIFIED	$CLEAN_REV"
0 comments (0 inline, 0 general)