From 7cb02a147017c21d7578ce02225bfd21aa4a60d4 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 29 Mar 2020 17:13:41 +0000 Subject: [PATCH] + git support git-svn-id: trunk@44399 - (cherry picked from commit f6b6622569df6f875adf47636f1496a9ef8799d9) --- utils/fpcm/get_revision.sh | 45 +++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/utils/fpcm/get_revision.sh b/utils/fpcm/get_revision.sh index e0b5316366..7b53b53133 100755 --- a/utils/fpcm/get_revision.sh +++ b/utils/fpcm/get_revision.sh @@ -14,18 +14,37 @@ export LANG tmpfiles= -for f in $important_sources ; do - tmpfile=.tmp.$f - tmpfiles="$tmpfiles $tmpfile" - svn info $f > $tmpfile -done +# git repository? +if [ -d ../../.git ] ; then + USEGIT=1 + echo Using git repository + # we just look for the last commit date here + for f in $important_sources ; do + tmpfile=.tmp.$f + tmpfiles="$tmpfiles $tmpfile" + echo "Change information for $f: " + git log -1 --pretty="format:%ci %h" $f > $tmpfile + echo >> $tmpfile + cat $tmpfile + done + git_date=`cat $tmpfiles | sort -n | tail -1 | gawk '{ print $1 }'` + + git_hash=`cat $tmpfiles | sort -n | tail -1 | gawk '{ print $4 }'` + + echo "Last date is $git_date, hash is $git_hash" + echo "'$git_date hash $git_hash'" > revision.inc +else + for f in $important_sources ; do + tmpfile=.tmp.$f + tmpfiles="$tmpfiles $tmpfile" + svn info $f > $tmpfile + done + + # echo "svn_info is $svn_info" + svn_date=`gawk '/Last Changed Date: / {print $4 }' $tmpfiles | sort -n | tail -1` + svn_rev=`gawk '/Last Changed Rev: / {print $4 }' $tmpfiles | sort -n | tail -1` + echo "for files $important_sources, date is $svn_date, rev is $svn_rev" + echo "'$svn_date rev $svn_rev'" > revision.inc +fi -# echo "svn_info is $svn_info" -svn_date=`gawk '/Last Changed Date: / {print $4 }' $tmpfiles | sort -n | tail -1` -svn_rev=`gawk '/Last Changed Rev: / {print $4 }' $tmpfiles | sort -n | tail -1` -echo "for files $important_sources, date is $svn_date, rev is $svn_rev" -echo "'$svn_date rev $svn_rev'" > revision.inc rm -Rf $tmpfiles - - -