Changeset - r10092:36ce5ba21174
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2008-09-08 10:08:55
rubidium@openttd.org
(svn r14273) -Change: make findversion.sh aware of release tags and make it output the REV without the branch name so the CF can use that.
1 file changed with 12 insertions and 2 deletions:
0 comments (0 inline, 0 general)
findversion.sh
Show inline comments
 
@@ -3,13 +3,13 @@
 
# Arguments given? Show help text.
 
if [ "$#" != "0" ]; then
 
	cat <<EOF
 
Usage: ./findversion.sh
 
Finds the current revision and if the code is modified.
 

	
 
Output: <REV>\t<REV_NR>\t<MODIFIED>
 
Output: <REV>\t<REV_NR>\t<MODIFIED>\t<CLEAN_REV>
 
REV
 
    a string describing what version of the code the current checkout is
 
    based on. The exact format of this string depends on the version
 
    control system in use, but it tries to identify the revision used as
 
    close as possible (using the svn revision number or hg/git hash).
 
    This also includes an indication of whether the checkout was
 
@@ -37,12 +37,15 @@ MODIFIED
 
    Modification is determined in relation to the commit identified by
 
    REV, so not in relation to the svn revision identified by REV_NR.
 

	
 
    A value of 1 means that the modified status is unknown, because this
 
    is not an svn/git/hg checkout for example.
 

	
 
CLEAN_REV
 
    the same as REV but without branch name
 

	
 
By setting the AWK environment variable, a caller can determine which
 
version of "awk" is used. If nothing is set, this script defaults to
 
"awk".
 
EOF
 
exit 1;
 
fi
 
@@ -64,14 +67,19 @@ if [ -d "$ROOT_DIR/.svn" ]; then
 
	# We are an svn checkout
 
	if svnversion "$SRC_DIR" | grep 'M' > /dev/null; 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 }'`
 
	if [ -n "$TAGS" ]; 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
 
		MODIFIED="2"
 
	fi
 
	HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null | cut -c1-8`
 
@@ -96,11 +104,13 @@ else
 
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"
 
echo "$REV	$REV_NR	$MODIFIED	$CLEAN_REV"
0 comments (0 inline, 0 general)