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

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu Mar 26 11:58:31 CET 2015

On 2015-03-26 10:42, vfclists . wrote:
> 'git svn find-rev' works for finding the Git commit refs from subversion
> refs only if the subversion refs are of the form rNNNNN, and I thought
> going the other way

Sorry, I probably haven't had enough coffee yet, but I don't fully
understand. I thought you wanted the latest svn revision number by using
a git mirror (of a subversion repo). That is exactly what the command
does that I posted.

For example. Here is the last commit I have in my lazarus repo (cloned
from the git mirror on Github).
$ git log -1
commit d7e9b24c9bb114264663cc45d7148a4ade3f2b24
Author: dmitry <dmitry at 4005530d-fff6-0310-9dd1-cebe43e6787f>
Date:   Thu Mar 26 00:48:36 2015 +0000

    printer4lazarus: carbon - replace OSX 10.5 (driver specific) code
with OSX 10.0 compatible code for getting printerinters DPI

    git-svn-id: http://svn.freepascal.org/svn/lazarus/trunk@48507

As far as I understood, you are interested in finding the SVN revision
of that commit - which is r48507 (by looking at the git-svn-id line.

$ git svn find-rev $(git log --max-count 1 --pretty=format:%H)

As you can see, the command returns exactly that revision for you.

The first time you run the 'git svn find-rev' git will do some layout
migration (svn info) for you. Maybe it is also because I'm using the
very latest Git. But after the first run, it will always only return the
svn revision number.

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

More information about the Lazarus mailing list