我如何在 Mercurial 中创建一个补丁文件,其中还包含所包含子存储库的更改
我们正在与多个人合作开展同一个项目,并使用 Mercurial 作为我们的 DVCS。我们的项目确实有几个子存储库。 我们确实需要通过邮件相互发送补丁,因为目前无法从主存储库中推送和拉取补丁。 导出命令 - 如果在主服务器上执行,只会为主服务器创建补丁,而不是为子存储库创建补丁。我们可以手动为这些创建路径,但我们想知道是否有更简单的方法来做到这一点?
We are working with severall people on the same project and are using Mercurial as our DVCS. Our project does have severall subrepos.
We do need to send patches to each other by mail, because it is at this moment impossible to push and pull from the master repo.
The export command - if executed on the master will only create a patch for the master, and not for the subrepo's. We could manually create pathes for those, but we would like to know if there is an easier way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如您所注意到的,对此没有内置支持。
也许您可以使用我编写的 onsub 扩展。这使得为子存储库生成补丁变得更加容易:
HG_SUBPATH 变量被替换为子存储库的路径。
如果您有嵌套子存储库,则失败,因为
hg export
无法编写补丁名称sub-foo/bar/baz.diff
。因此,您需要调整路径并将/
替换为-
或类似内容。您应该能够使用类似的hg onsub
调用导入补丁。如果您成功了,请随时在 wiki 页面上添加有关它的注释。也欢迎您看看是否可以扩展 onsub 扩展以使其更容易,也许可以通过添加一个选项来使 onsub 也在顶级存储库上运行,以及一个可以直接使用而不是咀嚼的新变量>HG_SUBPATH。
There is no built-in support for this, as you've noticed.
Maybe you can use the onsub extension I wrote. That makes it a little easier to generate patches for the subrepos:
The
HG_SUBPATH
variable is replaced with the path to the subrepo.That fails if you have nested subrepos since
hg export
cannot write a patch namessub-foo/bar/baz.diff
. So you need to massage the path and replace/
with-
or similar. You should be able to import the patches with a similarhg onsub
call.If you get it working, then feel free to add a note about it on the wiki page. You're also welcome to see if you can extend the onsub extension to make this easier, perhaps by adding an option to make onsub run on the top-level repo too, and a new variable that can be used directly instead of munging
HG_SUBPATH
.hg commit --subrepos
的情况下的子存储库 提交还必须包括来自子存储库的所有受影响的文件,因此 - 导出也会导出(?)这些文件hg commit --subrepos
this commit must include all affected files from subrepos also, thus - export will export (?) these files also正如马丁建议的那样,我编写了自己的扩展。我将在这里发布代码,希望有人能改进它或使其在 Mercurial 中默认可用...
谢谢马丁,我基于你的 onsub 扩展,是的,我知道它有一些问题,但现在,它达到了它的目的。 (超过 10 个子存储库和超过 1 层嵌套的问题)
反之亦然:
As Martin suggested, i wrote my own extension. I will post the code here, in the hope someone will improve it or make it defaulf available in mercurial ...
Thanks Martin, i based it on your onsub extension, and yes i know there are a few problems with it, but for now, it serves its purpose. (problems with more than 10 subrepos and more than 1 level of nesting)
And the other way around: