[Lazarus] How do you guys extract an SVN revision number from a Git commit ref?

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Mar 25 00:33:40 CET 2015


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 -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/




More information about the Lazarus mailing list