Changeset - r10096:fca41c68a5fe
[Not reviewed]
master
0 1 0
matthijs - 16 years ago 2008-09-09 10:48:04
matthijs@openttd.org
(svn r14277) -Change [Makefile]: Use [ -n ... ] instead of using return values from grep and read in findversion.sh.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
findversion.sh
Show inline comments
 
@@ -62,13 +62,13 @@ SRC_DIR=src
 

	
 
# Determine if we are using a modified version
 
# Assume the dir is not modified
 
MODIFIED="0"
 
if [ -d "$ROOT_DIR/.svn" ]; then
 
	# We are an svn checkout
 
	if svnversion "$SRC_DIR" | grep 'M' > /dev/null; then
 
	if [ -n "`svnversion \"$SRC_DIR\" | grep 'M'`" ]; then
 
		MODIFIED="2"
 
	fi
 
	# 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 } }'`
 
	TAGS=`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 } }'`
 
	REV_NR=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^Last Changed Rev:/ { print $4 }'`
 
@@ -76,22 +76,22 @@ if [ -d "$ROOT_DIR/.svn" ]; then
 
		REV=$TAGS
 
	else
 
		REV="r$REV_NR"
 
	fi
 
elif [ -d "$ROOT_DIR/.git" ]; then
 
	# We are a git checkout
 
	if git diff-index HEAD "$SRC_DIR" | read dummy; then
 
	if [ -n "`git diff-index HEAD \"$SRC_DIR\"`" ]; then
 
		MODIFIED="2"
 
	fi
 
	HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null | cut -c1-8`
 
	REV="g$HASH"
 
	BRANCH=`git branch|grep '[*]' | sed 's/\* //;s/^master$//'`
 
	REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s/.*(svn r\([0-9]*\)).*/\1/"`
 
elif [ -d "$ROOT_DIR/.hg" ]; then
 
	# We are a hg checkout
 
	if hg status "$SRC_DIR" | grep -v '^?' | read dummy; then
 
	if [ -n "`hg status \"$SRC_DIR\" | grep -v '^?'`" ]; then
 
		MODIFIED="2"
 
	fi
 
	HASH=`LC_ALL=C hg tip 2>/dev/null | head -n 1 | cut -d: -f3 | cut -c1-8`
 
	REV="h$HASH"
 
	BRANCH=`hg branch | sed 's/^default$//'`
 
	REV_NR=`LC_ALL=C hg log -k "svn" -l 1 --template "{desc}\n" "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s/.*(svn r\([0-9]*\)).*/\1/"`
0 comments (0 inline, 0 general)