如何让 Mercurial 发出冲突文件的基本修订版本以及修改后的版本?
我正在尝试使用 Mercurial 将两个分支合并在一起,但存在一些冲突。在 Subversion 中工作时,合并冲突会导致冲突的文件被统一的 diff 替换,我自己的文件版本添加了“.mine”扩展名,以及最后签入的文件版本带有“.rxxx” “添加了扩展名。
使用 Mercurial,我只能获得统一的差异以及添加了“.orig”扩展名的我自己的版本。
我习惯于在 Eclipse 中使用“Compare With > Each Other”命令或使用 FileMerge 自行编辑合并,但是,由于如果不手动获取并获取基本修订版本,则无法使用它,所以我无法使用此功能方式更多。
我不想在 hg merge 命令期间执行合并 - 我更喜欢在自己的时间进行合并。
我可以使用什么设置或扩展来实现这一点吗?
I'm trying to merge two branches together using mercurial and there are some conflicts. When working in Subversion, merge conflicts would result in the conflicted file being replaced by a unified diff, my own version of the file with the ".mine" extension added as well as the last checked in version of the file with the ".rxxx" extension added.
With mercurial, I only get the unified diff as well as my own version with the ".orig" extension added.
I'm used to editing the merges myself in my own time in eclipse using the "Compare With > Each Other" command or using FileMerge, however as the base revision is not available without manually going and fetching it I can't work this way any more.
I do not want to perform the merging during the hg merge command - I prefer to do it in my own time.
Is there a setting or extension I can use to make this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我们有一个内置的合并工具,称为
internal:dump
。因此,您将回到过去美好的 Subversion 时代,或者类似的时代。
We have a built-in merge tool for this called
internal:dump
. So withyou will be brought back to the good old Subversion-days, or something close to it.
如何设置一个合并工具,只保存 Mercurial 正在创建的文件以供合并工具操作?
然后在 mycopy.sh 中执行如下操作:
应该总是立即成功,并为您留下一个
.base
一个.mine
和一个.theirs
对于每个有冲突的文件。您可以在~/.hgrc
中设置一次并完成它。How about setting a merge tool that just saves the files mercurial is creating for the merge tool to operate on?
And then in mycopy.sh just do something like:
That should always succeed instantly and leave you with a
.base
a.mine
and a.theirs
for each file that conflicted. You can set that up once in your~/.hgrc
and be done with it.看一下
hgsolve
命令。合并开始后,在提交之前,您可以使用resolve
列出有冲突的文件,并将冲突标记为已解决或未解决,或者重新启动合并过程,所有这些粒度都可以单个文件而不是变更集。它不会为您提供所需的文件(尽管请参阅 @Ry4an 的答案),但只要您愿意解决任何特定文件,它就可以启动合并工具。
Take a look at the
hg resolve
command. Once a merge has started, but before it's been committed, you can useresolve
to list files with conflicts, as well as mark conflicts as resolved or unresolved, or restart the merging process, all at the granularity of individual files rather than changesets.It doesn't give you the files you want (though see @Ry4an's answer), but it can fire up your merge tools for any particular file whenever you care to resolve it.
您可以设置 HGMERGE 环境变量。
Mercurial 通常会首先尝试使用简单的合并算法来合并文件,看看它们是否可以在没有冲突的情况下合并。仅当存在冲突的更改时,hg 才会实际执行合并程序。
您可以将其设置为某些 GUI 合并工具等。
还有其他选项,例如内部:失败,内部:本地或内部:其他
在 hgrc 中:
因此您应该能够根据您的所有需要指定合并程序的参数。也许,您可以采用这种技术来启动 Eclipse。
进行合并冲突时立即失败,尝试
事实上,如果你想提前知道冲突,你可以使用 hg merge 的“预览”选项
You can set the HGMERGE environment variable.
Mercurial will usually attempt to merge the files using a simple merge algorithm first, to see if they can be merged without conflicts. Only if there are conflicting changes will hg actually execute the merge program.
You can set this to some GUI merge tool etc.
There are other options like internal:fail, internal:local, or internal:other
In hgrc:
So you should be able to specify merge program's arguments with all your needs. Probably, you can adopt this technique for Eclipse to be fired up.
To make merge fail immediately on conflict, try
In fact, if you want to know the conflict in advance, you could use the "preview" option for hg merge