Mercurial-看到需要手动合并的文件列表吗? [英] Mercurial - see list of files that need to be manually merged?

查看:74
本文介绍了Mercurial-看到需要手动合并的文件列表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hg pull之后是否可以使用Mercurial命令查看在执行hg merge时需要手动合并(即,有冲突)的所有文件的列表?

Is there a Mercurial command you can use after an hg pull to see a list of all files that will be need to be manually merged (ie: that have conflicts) when doing an hg merge?

推荐答案

hg resolve --list

文档:

具有未解决冲突的合并通常是使用internal:merge配置设置或诸如diff3之类的命令行合并工具进行非交互式合并的结果. resolve命令用于管理合并中运行的文件,运行hg合并之后,运行hg commit之前的文件(即工作目录必须有两个父目录).

Merges with unresolved conflicts are often the result of non-interactive merging using the internal:merge configuration setting, or a command-line merge tool like diff3. The resolve command is used to manage the files involved in a merge, after hg merge has been run, and before hg commit is run (i.e. the working directory must have two parents).

修改2012年1月5日:

(我今天对此答案进行了投票,因此我重新进行了审查.发现我误解了这个问题.)

问题是我已经从远程存储库执行了一次提取操作,并且还没有执行了合并.我可以看到执行合并后会产生什么冲突吗?"

The question is "I have performed a pull from a remote repository and have not yet performed a merge. Can I see what conflicts will be created upon performing the merge?"

我上面的回答显然是错误的.阅读了链接的文档后,我认为没有内置的方法可以执行此操作.但是,有一种方法可以做到而又不会破坏您正在工作的源代码树.

My answer above is clearly wrong. After reading through the linked documentation, I do not think there is a built-in method for doing this. However, there is a way to do it without ruining your working source tree.

假设您已将存储库 A 从某个远程源克隆到本地系统(即hg clone http://hg.example.com/A B)上的存储库 B .之后,您对本地存储库 B 进行了更改,其中涉及至少一次提交.同时,对存储库 A 进行了更改,以便在执行拉取操作时收到一条消息,指示已添加新的更改集并已创建头.

Let's assume you have cloned repository A from some remote source to repository B on your local system, i.e. hg clone http://hg.example.com/A B. After doing so, you make changes to your local repository, B, that involve at least one commit. In the meantime, changes have been made to repository A so that when you do a pull you get a message indicated new changesets have been added and heads have been created.

这时,您可以执行hg heads列出合并中将涉及的两个变更集.根据此信息,您可以发出状态命令以列出磁头之间的差异.假设根据标题列表,存储库 B 中的修订号是"1"和"2",那么您可以执行hg status --rev 1:2来查看更改列表.

At this point, you can do hg heads to list the two changesets that will be involved in a merge. From this information, you can issue a status command to list the differences between the heads. Assuming the revision numbers in your repository B, according to the heads list, are "1" and "2", then you can do hg status --rev 1:2 to see a list of the changes.

当然,这并不能真正告诉您合并时是否会发生冲突.由于没有命令可以向您显示此内容,因此您必须通过克隆到新的存储库并在此处进行合并来预览"合并.因此,hg clone B C && cd C && hg merge.如果您对合并的结果感到满意,则可以执行hg com -m 'Merging complete' && hg push && cd ../ && rm -rf C.

Of course, this doesn't really tell you if conflicts will occur when you do a merge. Since there isn't a command that will show you this, you will have to "preview" the merge by cloning to a new repository and doing the merge there. So, hg clone B C && cd C && hg merge. If you are satisfied with the result of this merge you can do hg com -m 'Merging complete' && hg push && cd ../ && rm -rf C.

这是一个过程,但是如果合并证明确实是灾难,它可以使您当前的源代码树保持干净.您可能还会发现使用公共存储库的描述会很有帮助.

It's a bit of a process, but it keeps your current source tree clean if the merge turns out to be a disaster. You might also find this description of working with public repositories helpful.

这篇关于Mercurial-看到需要手动合并的文件列表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆