简体   繁体   English

SVN到HG:现在从HG变更集输出SVN修订版号

[英]SVN to HG: Now output SVN revision number from HG changeset

I converted a Subversion repository to Mercurial, using the Convert extension. 我使用Convert扩展将Subversion存储库转换为Mercurial。 When I look at the new repository with Tortoise HG, I see in each changeset the corresponding source path and revision (see image). 当我使用Tortoise HG查看新存储库时,我会在每个变更集中看到相应的源路径和修订版(参见图像)。 Tortoise HG屏幕截图,带有HG Changeset和SVN源路径/修订版

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. 我知道我可以使用带模板选项的hg log来自定义输出,但不知道如何获取Subversion源路径/修订版。

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. svn源路径/修订版位于变更集内的一个名为extras的字段中(感谢@ Ry4en), hg loghg export都不输出该值。 What I will try now is to use the file .hg/shamap in combination with 我现在要尝试的是将文件.hg/shamap与。结合使用

hg log --template 'hg:{rev} nodeid:{node}'

To map the Mercurial revision to the SVN source path/revision. 将Mercurial修订映射到SVN源路径/修订版。

EDIT2: My Mercurial version is 1.4.3. EDIT2:我的Mercurial版本是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 使用Mercurial 1.7.1可以使用此命令(感谢@ Wim Coenen): hg log --template {node}\\n{extras}\\n\\n

New versions of hgsubversion adds a {svnrev} template keyword. 新版本的hgsubversion添加了{svnrev}模板关键字。 This is described in hg help subversion : 这在hg help subversion有描述:

[...] [...]

Finding and displaying Subversion revisions 查找并显示Subversion修订版

For revealing the relationship between Mercurial changesets and Subversion revisions, hgsubversion provides three template keywords: 为了揭示Mercurial变更集与Subversion修订版之间的关系,hgsubversion提供了三个模板关键字:

  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. 使用Mercurial 1.5或更高版本时,模板关键字可用。

For finding changesets from Subversion, hgsubversion extends revsets to provide two new selectors: 为了从Subversion中查找变更集,hgsubversion扩展了revsets以提供两个新的选择器:

  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. 使用Mercurial 1.6或更高版本时可以使用Revsets,并且可以通过多个Mercurial命令接受Revsets来指定修订版。 See "hg help revsets" for details. 有关详细信息,请参阅“hg help revsets”。

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. 它隐藏在变更集中名为extras的字段中,我不相信它有一个日志模板条目。 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. 它可能会出现在hg export中,您可以从中进行grep,并且它当然可以通过编程方式获得,但我认为没有 - --template方式来获取它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM