Patchwork [4,of,6] merge: let _forgetremoved() work on the file->action dict

login
register
mail settings
Submitter Martin von Zweigbergk
Date Dec. 17, 2014, 9:24 p.m.
Message ID <8c8d94bee5ed8f86b679.1418851476@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/7155/
State Superseded
Commit 9b0ff15925f4b4bb1e4db8c3ef98e10f41ebfbbf
Headers show

Comments

Martin von Zweigbergk - Dec. 17, 2014, 9:24 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1418363929 28800
#      Thu Dec 11 21:58:49 2014 -0800
# Node ID 8c8d94bee5ed8f86b679db55a6deabf5a04188fb
# Parent  b30321ecfb9672e09141d590ead0e3c359830675
merge: let _forgetremoved() work on the file->action dict

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -318,20 +318,20 @@ 
     as removed.
     """
 
-    ractions = []
-    factions = xactions = []
+    actions = {}
+    m = 'f'
     if branchmerge:
-        xactions = ractions
+        m = 'r'
     for f in wctx.deleted():
         if f not in mctx:
-            xactions.append((f, None, "forget deleted"))
+            actions[f] = m, None, "forget deleted"
 
     if not branchmerge:
         for f in wctx.removed():
             if f not in mctx:
-                factions.append((f, None, "forget removed"))
+                actions[f] = 'f', None, "forget removed"
 
-    return ractions, factions
+    return actions
 
 def _checkcollision(repo, wmf, actions):
     # build provisional merged manifest up
@@ -617,17 +617,16 @@ 
 
     _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
 
+    if wctx.rev() is None:
+        fractions = _forgetremoved(wctx, mctx, branchmerge)
+        actions.update(fractions)
+
     # 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))
 
-    if wctx.rev() is None:
-        ractions, factions = _forgetremoved(wctx, mctx, branchmerge)
-        actions['r'].extend(ractions)
-        actions['f'].extend(factions)
-
     return actions, diverge, renamedelete
 
 def batchremove(repo, actions):