[PATCH 3 of 6] merge: let _resolvetrivial() work on the file->action dict

Martin von Zweigbergk martinvonz at google.com
Wed Dec 17 15:24:35 CST 2014


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1418360776 28800
#      Thu Dec 11 21:06:16 2014 -0800
# Node ID b30321ecfb9672e09141d590ead0e3c359830675
# Parent  3e68d3bbe0c72bd1eb9633c6a70e06291ed69309
merge: let _resolvetrivial() work on the file->action dict

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -531,25 +531,13 @@
     """Resolves false conflicts where the nodeid changed but the content
        remained the same."""
 
-    cdactions = []
-    for action in actions['cd']:
-        f = action[0]
-        if f in ancestor and not wctx[f].cmp(ancestor[f]):
+    for f, (m, args, msg) in actions.items():
+        if m == 'cd' and f in ancestor and not wctx[f].cmp(ancestor[f]):
             # local did change but ended up with same content
-            actions['r'].append((f, None, "prompt same"))
-        else:
-            cdactions.append(action)
-    actions['cd'] = cdactions
-
-    dcactions = []
-    for action in actions['dc']:
-        f = action[0]
-        if f in ancestor and not mctx[f].cmp(ancestor[f]):
+            actions[f] = 'r', None, "prompt same"
+        elif m == 'dc' and f in ancestor and not mctx[f].cmp(ancestor[f]):
             # remote did change but ended up with same content
-            pass # don't get = keep local deleted
-        else:
-            dcactions.append(action)
-    actions['dc'] = dcactions
+            del actions[f] # don't get = keep local deleted
 
 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial,
                      acceptremote, followcopies):
@@ -627,14 +615,14 @@
             continue
         repo.ui.note(_('end of auction\n\n'))
 
+    _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
+
     # Convert to dictionary-of-lists format
     actionbyfile = actions
     actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split())
     for f, (m, args, msg) in actionbyfile.iteritems():
         actions[m].append((f, args, msg))
 
-    _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
-
     if wctx.rev() is None:
         ractions, factions = _forgetremoved(wctx, mctx, branchmerge)
         actions['r'].extend(ractions)


More information about the Mercurial-devel mailing list