2009-07-31 23:16:02 +02:00
|
|
|
#! /bin/bash
|
2009-07-30 22:21:44 +02:00
|
|
|
#
|
2009-07-31 00:40:44 +02:00
|
|
|
rev_new_raw=$(svnversion -n . 2>/dev/null | tr '\n' ' ' | tr -d '\r')
|
|
|
|
[ -n "$rev_new_raw" ] || rev_new_raw=$(SubWCRev . 2>/dev/null | tr '\n' ' ' | tr -d '\r')
|
2009-07-30 22:21:44 +02:00
|
|
|
|
|
|
|
|
2009-07-31 00:40:44 +02:00
|
|
|
rev_new_raw=$(echo $rev_new_raw | sed 's/[^0-9]*\([0-9]*\)\(.*\)/\1 \2/')
|
|
|
|
rev_new=0
|
|
|
|
a=$(echo $rev_new_raw | sed 's/\([0-9]*\).*/\1/')
|
|
|
|
let "a+=0"
|
|
|
|
#find max rev
|
|
|
|
while [ "$a" ]; do
|
|
|
|
[ "$a" -gt "$rev_new" ] && rev_new=$a
|
|
|
|
rev_new_raw=$(echo -n $rev_new_raw | sed 's/[0-9]*[^0-9]*\([0-9]*\)\(.*\)/\1 \2/')
|
|
|
|
a=$(echo $rev_new_raw | sed 's/\([0-9]*\).*/\1/')
|
|
|
|
done
|
2009-07-30 22:21:44 +02:00
|
|
|
|
2009-07-31 00:40:44 +02:00
|
|
|
rev_old=$(cat ./source/svnrev.c 2>/dev/null | tr -d '\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/')
|
|
|
|
|
|
|
|
if [ "$rev_new" != "$rev_old" ] || [ ! -f ./source/svnrev.c ]; then
|
|
|
|
|
|
|
|
cat <<EOF > ./source/svnrev.c
|
|
|
|
#define SVN_REV "$rev_new"
|
|
|
|
|
|
|
|
const char *GetRev()
|
|
|
|
{
|
|
|
|
return SVN_REV;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
if [ -n "$rev_new" ]; then
|
|
|
|
echo "Changed Rev $rev_old to $rev_new" >&2
|
|
|
|
else
|
|
|
|
echo "svnrev.c created" >&2
|
|
|
|
fi
|
2009-07-30 22:21:44 +02:00
|
|
|
echo >&2
|
|
|
|
fi
|
|
|
|
echo $a
|