Mercurial 将补丁复制到存储库
我正在使用 Mercurial 存储库,并且有一个“git”格式的补丁,我想知道如何将该补丁应用到我当前的本地存储库。
谢谢
I'm using Mercurial repository and I have a patch in 'git' format and I wanted to know how I can apply that patch to my current repository which is Local.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
hg import <补丁文件>
< /a> 应该能够处理 git 风格的补丁。如果您不希望它在导入每个补丁后自动提交更改,请使用
hg import --no-commit
。Mozilla 的常见问题解答提到了这一点: https://developer.mozilla.org/en/Mercurial_FAQ#How_can_I_diff_and_patch_files .3f
hg import <patchfile(s)>
should be able to handle git-style patches.Use
hg import --no-commit <patchfile(s)>
if you don't want it to automatically commit the changes after each patch is imported.Mozilla's FAQ mentions this: https://developer.mozilla.org/en/Mercurial_FAQ#How_can_I_diff_and_patch_files.3f
尝试
hg import --no-commit
,Mozilla 有一个相当有用的常见问题解答 关于 Git 和 Mercurial 之间的交易补丁。根据您的平台,您也可以只使用
patch
,例如patch -p1
patch -p1
patch -p1
patch some_patch_from_git.patch
。这实际上可能会更好,因为您会看到任何模糊之处,而不必仅仅为了一个补丁而信任作者。编辑
如果您的补丁没有完全插入,则上述方法都不起作用。如果大佬们未能应用的话,你的代码库并不是补丁所期望的。查看拒绝并查看补丁期望您的代码在任何给定行中的内容,然后相应地重新设置基准。
Try
hg import --no-commit
, Mozilla has a rather useful FAQ regarding trading patches between Git and Mercurial.Depending on your platform, you can also just use
patch
, e.g.patch -p1 < some_patch_from_git.patch
. That may actually be better as you'll see any fuzz and not have to deal with trusting the author just for one patch.Edit
If your patch does not go in cleanly, none of the above methods are going to work. Your code base is not what the patch expects if hunks fail to apply. Look at the rejects and see what the patch expected your code to be at any given line, then rebase accordingly.