1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#!/bin/bash
#
# This file is part of the Simutrans project under the Artistic License.
# (see LICENSE.txt)
#
#
# script to the revision number and put it into the file revision.h
#
svn info 2>/dev/null 1>/dev/null
if [ $? -eq 0 ]; then
# using svn for verything
REV=$(svnversion)
HASH=$REV
else
# try using git
git describe --always 2>/dev/null 1>/dev/null
if [ $? -eq 0 ]; then
REV=$(git log -1 | grep "git-svn-id" | sed "s/^.*trunk\@//" | sed "s/ .*$//")
if [ -z "$REV" ]; then
# make preudo rev from git
REV=$(git rev-list --count --first-parent HEAD)
REV=`expr $REV + 328`
fi
else
REV=""
fi
fi
echo "$REV"
|