[Lazarus] How do you guys extract an SVN revision number from a Git commit ref?
vfclists .
vfclists at gmail.com
Thu Mar 26 06:47:32 CET 2015
On 24 March 2015 at 23:33, Graeme Geldenhuys <mailinglists at geldenhuys.co.uk>
wrote:
> On 2015-03-24 21:10, vfclists . wrote:
> >
> > git log -n 1 | head -n 7 | tail -n 1 | cut -d "@" -f 2 | cut -d " " -f 1
>
>
> Try:
>
> git svn find-rev $(git log --max-count 1 --pretty=format:%H)
>
>
> Alternatively you could do something like this:
>
> git log -n 1 -z | grep "trunk@[0-9]* "
>
> Tweak the regex to use lookbehind which could then trim the "trunk@"
> prefix. I don't know the regex syntax for grep. The following regex does
> the trick in my editor of choice, but not in the command above for some
> reason.
>
> (?<=trunk@)[0-9]+
>
>
>
> Regards,
> - Graeme -
>
>
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`
It searches the commit log for the 10 lines after the git commit ref ,
looks for the line saying git-svn-id and gets the part after the '@' at
sign. It needs more refinement though.
--
Frank Church
=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150326/ce1f1fa1/attachment-0003.html>
More information about the Lazarus
mailing list