Patchwork [1,of,2,stable] merge: show the scary multiple ancestor hint for merges only, not for updates

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 15, 2014, 12:51 a.m.
Message ID <c6a530bf80a3cc127fad.1408063907@mk-desktop>
Download mbox | patch
Permalink /patch/5404/
State Accepted
Headers show

Comments

Mads Kiilerich - Aug. 15, 2014, 12:51 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1408063141 -7200
#      Fri Aug 15 02:39:01 2014 +0200
# Branch stable
# Node ID c6a530bf80a3cc127fadf7a94d96ddbf4074e837
# Parent  989c16c1b050a314e136675ca9ac73a90d13da2a
merge: show the scary multiple ancestor hint for merges only, not for updates

Updates with uncommited changes will always only have one ancestor - the parent
revision. Updates between existing revision should (and will) always give the
same result no matter which ancestor is used. The warning is thus only relevant
when doing a "real" merge.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1052,7 +1052,7 @@  def update(repo, node, branchmerge, forc
                 cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node())
                 pas = [repo[anc] for anc in (sorted(cahs) or [nullid])]
             else:
-                pas = [p1.ancestor(p2, warn=True)]
+                pas = [p1.ancestor(p2, warn=branchmerge)]
 
         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
 
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
@@ -24,8 +24,6 @@  Criss cross merging
   $ hg ci -m '5 second change f1'
 
   $ hg up -r3
-  note: using 0f6b37dbe527 as ancestor of adfe50279922 and cf89f02107e5
-        alternatively, use --config merge.preferancestor=40663881a6dd
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo '6 second change' > f2
   $ hg ci -m '6 second change f2'
@@ -169,8 +167,6 @@  Redo merge with merge.preferancestor="*"
 The other way around:
 
   $ hg up -C -r5
-  note: using 0f6b37dbe527 as ancestor of 3b08d01b0ab5 and adfe50279922
-        alternatively, use --config merge.preferancestor=40663881a6dd
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge -v --debug --config merge.preferancestor="*"
   note: merging adfe50279922+ and 3b08d01b0ab5 using bids from ancestors 0f6b37dbe527 and 40663881a6dd