Patchwork [4,of,5] bidmerge: choose shortest list of diverge and rename/delete warnings

login
register
mail settings
Submitter Matt Mackall
Date Sept. 23, 2015, 8:07 p.m.
Message ID <e049591df84e39f58b26.1443038830@ruin.waste.org>
Download mbox | patch
Permalink /patch/10599/
State Accepted
Headers show

Comments

Matt Mackall - Sept. 23, 2015, 8:07 p.m.
# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 1440011142 18000
#      Wed Aug 19 14:05:42 2015 -0500
# Node ID e049591df84e39f58b2615cfdb9a371422295f61
# Parent  70d573eac86803219037c7f430421e8bcae1108c
bidmerge: choose shortest list of diverge and rename/delete warnings

Slightly less arbitrary than choosing the first set.

Patch

diff -r 70d573eac868 -r e049591df84e mercurial/merge.py
--- a/mercurial/merge.py	Wed Aug 19 14:04:54 2015 -0500
+++ b/mercurial/merge.py	Wed Aug 19 14:05:42 2015 -0500
@@ -596,10 +596,14 @@ 
                 repo, wctx, mctx, ancestor, branchmerge, force, partial,
                 acceptremote, followcopies)
             _checkunknownfiles(repo, wctx, mctx, force, actions)
-            if diverge is None: # and renamedelete is None.
-                # Arbitrarily pick warnings from first iteration
+
+            # Track the shortest set of warning on the theory that bid
+            # merge will correctly incorporate more information
+            if diverge is None or len(diverge1) < len(diverge):
                 diverge = diverge1
+            if renamedelete is None or len(renamedelete) < len(renamedelete1):
                 renamedelete = renamedelete1
+
             for f, a in sorted(actions.iteritems()):
                 m, args, msg = a
                 repo.ui.debug(' %s: %s -> %s\n' % (f, msg, m))