开发者

Understanding Mercurial merging logic

Let's say myfile was modified in two repositories (A and B). In A we do an hg pull ../B which gets us these changesets:

A1 - A2 - A3 - A4 - A5
        \
          B3 - B4

As we have two heads (A5, B4), we do an hg merge.

Now if there are conflicts, Mercurial fires up our merge tool (Beyond Compare) and we get three views: left is local, center is parent, and right is 'other'. Given our structure, would left (loca开发者_如何转开发l) be A5, center (parent) be A2, and right (other) be B4?

Secondly, what exactly is the logic that Mercurial uses to determine that a merge is required? Does it see that there are two versions of myfile without any children? And how exactly does it determine that A2 is the parent?


As mentioned in Merge Tool Configuration

The merge tool is run with an argument list of args with the following variables expanded:

  • $output expands to the existing file which already contains the version from the first parent - and this is also where the result of the merge ends up / must end up
  • $local expands to file.orig which is created as a copy of file in the working directory version - it thus contains the unmerged version from the first parent
  • $base expands to /tmp/file~base.* which is created with the version from the common ancestor revision (see hg debugancestor)
  • $other expands to /tmp/file~other.* which is created with the version from the new second parent revision which the first parent is merged with

(so yes, "left (local) be A5, center (parent) be A2, and right (other) be B4")

Understanding Mercurial merging logic

(See "performing the merge")

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜