summaryrefslogtreecommitdiff
path: root/findversion.sh
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-02 16:38:26 +0000
committerrubidium <rubidium@openttd.org>2010-08-02 16:38:26 +0000
commite8dc701cc42b3f92703930812594d04a32823caf (patch)
treef4d5da47f4004d9d8cec2746bc2568117e8c32f9 /findversion.sh
parent6371e6c4db8a131911da091563818c2c8cfa92f0 (diff)
downloadopenttd-e8dc701cc42b3f92703930812594d04a32823caf.tar.xz
(svn r20308) -Change: don't only look at only the src directory for the revision, but at the parent of the src directory.
Diffstat (limited to 'findversion.sh')
-rwxr-xr-xfindversion.sh19
1 files changed, 9 insertions, 10 deletions
diff --git a/findversion.sh b/findversion.sh
index 5e4e6f442..18068ad30 100755
--- a/findversion.sh
+++ b/findversion.sh
@@ -66,20 +66,19 @@ fi
# Find out some dirs
cd `dirname "$0"`
ROOT_DIR=`pwd`
-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 [ -n "`svnversion \"$SRC_DIR\" | grep 'M'`" ]; then
+ if [ -n "`svnversion | 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 } }'`
- 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 } }'`
- REV_NR=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^Last Changed Rev:/ { print $4 }'`
+ 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 | "$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 | "$AWK" '/^Last Changed Rev:/ { print $4 }'`
if [ -n "$TAG" ]; then
REV=$TAG
else
@@ -89,26 +88,26 @@ 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 \"$SRC_DIR\"`" ]; then
+ 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 -- "$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
# 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
elif [ -d "$ROOT_DIR/.hg" ]; then
# We are a hg checkout
- if [ -n "`hg status \"$SRC_DIR\" | grep -v '^?'`" ]; then
+ 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 -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
# We don't know
MODIFIED="1"