本文介绍了查找两个分支的最新合并点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两个分支,如何找到两个分支合并的最新修订版本?是否有标准的Mercurial命令可以做到这一点?

Having two branches, how can I find the latest revision(s) where the two branches were merged? Is there a standard Mercurial command to do that?

这与问题 ,但要使用Mercurial而非Subversion.

This is the same as question How to find the common ancestor of two branches in SVN?, but for Mercurial instead of subversion.

我不明白为什么Lazy Badger的答案是正确的,所以我不得不作一些画图,现在我明白了:

I didn't understand why Lazy Badger's answer was the right one, so I had to make a little drawing, and now I get it:

当两个分支合并时,它们并不是真正的合并",但是来自一个分支的更改将集成到第二个分支中.这意味着合并提交仅属于原始分支,而不属于合并分支.这就是为什么合并修订版是祖先修订版的两个子版本之一的原因.

When two branches are merged, they are not really "merged", but the changes from one branch are integrated into a second branch. This means that the merge commit only belongs to the originating branch, and not to the merged branch. This is why the merge revision is one of the two children of the ancestor revision.

这可能是最好的搭配图片:

This is probably best seen with a picture:

default o----o----a---b---o---o
         \         \
other     `-o---o---m---o

ancestor(default,other) == a
children(ancestor(default,other)) == (b,m)
children(ancestor(default,other)) and merge() == m

推荐答案

hg log -r "children(ancestor(default, Cleanup)) and merge()" --template "{rev}\n"

的最新合并,用于默认分支和清理"分支(Tim Henigan的答案的抛光版).

is latest merge for default and Cleanup branches (polished version of Tim Henigan's answer).

这篇关于查找两个分支的最新合并点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 20:09