[geos-commits] r4393 - trunk/tools
Sandro Santilli
strk at kbt.io
Sat Apr 1 06:00:07 PDT 2017
Author: strk
Date: 2017-04-01 06:00:06 -0700 (Sat, 01 Apr 2017)
New Revision: 4393
Modified:
trunk/tools/repo_revision.sh
Log:
Use git describe as revision code if SVN metadata is not available
Fixes #794
Modified: trunk/tools/repo_revision.sh
===================================================================
--- trunk/tools/repo_revision.sh 2017-04-01 11:01:09 UTC (rev 4392)
+++ trunk/tools/repo_revision.sh 2017-04-01 13:00:06 UTC (rev 4393)
@@ -29,14 +29,24 @@
echo 0;
fi
- rev=`cd ${top_srcdir} && ${git_exe} log --grep=git-svn -1 | grep git-svn | cut -d@ -f2 | cut -d' ' -f1`
+ last_commit=`cd ${top_srcdir} && ${git_exe} log -1`
- if test -z "$rev"; then
- echo "Can't fetch SVN revision from git log" >&2
+ if test -z "$last_commit"; then
+ echo "Can't fetch last commit info from git log" >&2
echo 0
- else
- echo r$rev
+ return
fi
+
+ svnrev=`echo "$last_commit" | grep git-svn | cut -d@ -f2 | cut -d' ' -f1`
+ if test -n "$svnrev"; then
+ # Last commit has SVN metadata, we'll use that
+ echo r$svnrev
+ return
+ fi
+
+ # Last commit has no SVN metadata, we'll use sha
+ sha=`cd ${top_srcdir} && ${git_exe} describe --always`
+ echo $sha
}
read_rev_svn() {
More information about the geos-commits
mailing list