Patchwork [5,of,6] merge: reuse 'r' action code for 'rm' actions in recordupdates()

login
register
mail settings
Submitter Martin von Zweigbergk
Date Dec. 3, 2014, 5:17 p.m.
Message ID <79d509ee6a41ef5903bf.1417627035@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6977/
State Superseded
Headers show

Comments

Martin von Zweigbergk - Dec. 3, 2014, 5:17 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1416814310 28800
#      Sun Nov 23 23:31:50 2014 -0800
# Node ID 79d509ee6a41ef5903bf78cc75d9cd0e5213807d
# Parent  4491dd19d9566ad6b64ddb50312b1e6d57a24e27
merge: reuse 'r' action code for 'rm' actions in recordupdates()

The 'r' and 'rm' actions behave the same in recordupdates(), and the
'm' (merge) action has already caused the move source to be stored
away, so we can safely remove the file a little earlier (where 'r'
actions are being acted upon).

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -852,11 +852,12 @@ 
 def recordupdates(repo, actions, branchmerge):
     "record merge actions to the dirstate"
     # remove (must come first)
-    for f, args, msg in actions['r']:
-        if branchmerge:
-            repo.dirstate.remove(f)
-        else:
-            repo.dirstate.drop(f)
+    for m in 'r', 'rm':
+        for f, args, msg in actions[m]:
+            if branchmerge:
+                repo.dirstate.remove(f)
+            else:
+                repo.dirstate.drop(f)
 
     # forget (must come first)
     for f, args, msg in actions['f']:
@@ -903,13 +904,6 @@ 
             if f2 == f: # file not locally copied/moved
                 repo.dirstate.normallookup(f)
 
-    # remove file that moved away
-    for f, args, msg in actions['rm']:
-        if branchmerge:
-            repo.dirstate.remove(f)
-        else:
-            repo.dirstate.drop(f)
-
     # directory rename, move local
     for f, args, msg in actions['dm']:
         f0, flag = args