[Lazarus] How do you guys extract an SVN revision number from a Git commit ref?
mailinglists at geldenhuys.co.uk
Thu Mar 26 10:46:53 CET 2015
On 2015-03-26 05:47, vfclists . wrote:
> This is what I have settled on in the mean time.
> LAZ_SVN_REVISION=`git log | grep -A 10 $LAZ_GIT_REVISION | grep
> git-svn-id | cut -d "@" -f 2 | cut -d " " -f 1`
Didn't the following work for you? It extracts exactly what you want and
will work on any commit, no matter how long the commit message, and only
uses built-in git functionality.
git svn find-rev $(git log --max-count 1 --pretty=format:%H)
The "find-rev" needs a SHA1 value, which is what the second part of the
command (in brackets) does. So if the above command doesn't work in your
script as one command, simply split it into two.
SHA1 = `git log --max-count 1 --pretty=format:%H`
REVISION = `git svn find-rev $SHA1`
Or something like that.
- Graeme -
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
More information about the Lazarus