I converted a Subversion repository to Mercurial, using the Convert extension. When I look at the new repository with Tortoise HG, I see in each changeset the corresponding source path and revision (see image).
Is there a way to write those two out to the console? Ideally I'd like an output like this:
hg:1147 svn:trunk@7201
hg:1146 svn:trunk@7200
...
I know that I can use hg log
with the template option to customize the output, but don't know how to get the Subversion source path/revision.
EDIT:
It looks like the way I wanted to go is not possible. The svn source path/revision is in a field called extras
within the changeset (thanks @Ry4en) and neither hg log
nor hg export
output this value. What I will try now is to use the file .hg/shamap
in combination with
hg log --template 'hg:{rev} nodeid:{node}'
To map the Mercurial revision to the SVN source path/revision.
EDIT2:
My Mercurial version is 1.4.3.
With Mercurial 1.7.1 it's possible to use this command (thanks @ Wim Coenen): hg log --template {node}\n{extras}\n\n
New versions of hgsubversion adds a {svnrev}
template keyword. This is described in hg help subversion
:
[...]
Finding and displaying Subversion revisions
For revealing the relationship between Mercurial changesets and Subversion revisions, hgsubversion provides three template keywords:
svnrev Expanded to the original Subversion revision number. svnpath The path within the repository that the changeset represents. svnuuid The Universally Unique Identifier of the Subversion repository.
An example:
$ hg log --template='{rev}:{node|short} {author|user}\nsvn: {svnrev}\n'
The template keywords are available when using Mercurial 1.5 or later.
For finding changesets from Subversion, hgsubversion extends revsets to provide two new selectors:
fromsvn Select changesets that originate from Subversion. Takes no arguments. svnrev Select changesets that originate in a specific Subversion revision. Takes a revision argument.
For example:
$ hg log -r 'fromsvn()' $ hg log -r 'svnrev(500)'
Revsets are available when using Mercurial 1.6 or later and are accepted by several Mercurial commands for specifying revisions. See "hg help revsets" for details.
It's tucked away in a field named extras
on the changeset, and I don't believe there is a log template entry for it. It might show up in a hg export
from which you could grep it, and it's certainly available programmatically, but I don't think there's a --template
way to get it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With