[PATCH 2 of 3] merge: use bid merge by default (BC)

Mads Kiilerich mads at kiilerich.com
Tue Sep 30 20:42:07 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1412127671 -7200
#      Wed Oct 01 03:41:11 2014 +0200
# Node ID f9401645aaad1847fe5b3d0ebf49f2c0b76127a1
# Parent  1cc49a02d89b1845e695bc6fcbd1a717b462e33d
merge: use bid merge by default (BC)

In most cases merges will work exactly as before.

The only difference is in criss-cross merge situations where there is multiple
ancestors. Instead of picking an more or less arbitrary ancestor, it will
consider both ancestors and pick the best bids.

Bid merge can be disabled with --config merge.preferancestor='!'.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -779,7 +779,7 @@ def calculateupdates(repo, wctx, mctx, a
                                 branchmerge, force,
                                 partial, acceptremote, followcopies)
 
-    else: # only when merge.preferancestor=* - experimentalish code
+    else: # only when merge.preferancestor=* - the default
         repo.ui.status(
             _("note: merging %s and %s using bids from ancestors %s\n") %
             (wctx, mctx, _(' and ').join(str(anc) for anc in ancestors)))
@@ -1048,7 +1048,7 @@ def update(repo, node, branchmerge, forc
 
         p2 = repo[node]
         if pas[0] is None:
-            if repo.ui.config("merge", "preferancestor") == '*':
+            if repo.ui.config("merge", "preferancestor", '*') == '*':
                 cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node())
                 pas = [repo[anc] for anc in (sorted(cahs) or [nullid])]
             else:
diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -72,7 +72,7 @@ Criss cross merging
      summary:     0 base
   
 
-  $ hg merge -v --debug --tool internal:dump 5
+  $ hg merge -v --debug --tool internal:dump 5 --config merge.preferancestor='!'
   note: using 0f6b37dbe527 as ancestor of 3b08d01b0ab5 and adfe50279922
         alternatively, use --config merge.preferancestor=40663881a6dd
     searching for copies back to rev 3
@@ -209,13 +209,13 @@ The other way around:
 Verify how the output looks and and how verbose it is:
 
   $ hg up -qC
-  $ hg merge --config merge.preferancestor="*"
+  $ hg merge
   note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
   $ hg up -qC
-  $ hg merge -v --config merge.preferancestor="*"
+  $ hg merge -v
   note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
   
   calculating bids for ancestor 0f6b37dbe527
@@ -288,7 +288,7 @@ http://stackoverflow.com/questions/93500
   $ echo b >> x
   $ hg commit -qm cb
 
-  $ hg merge
+  $ hg merge --config merge.preferancestor='!'
   note: using 70008a2163f6 as ancestor of 0d355fdef312 and 4b8b546a3eef
         alternatively, use --config merge.preferancestor=b211bbc6eb3c
   merging x


More information about the Mercurial-devel mailing list