merge: pass mergeresult obj instead of actions in _filternarrowactions()
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 24 Jul 2020 17:49:13 +0530
changeset 45285 e7196f1da2b1
parent 45284 31c454a5f1a8
child 45286 00e9c5edcd58
merge: pass mergeresult obj instead of actions in _filternarrowactions() We want to use rich mergeresult object and it's APIs instead of handling a dictionary. Differential Revision: https://phab.mercurial-scm.org/D8823
mercurial/merge.py
--- a/mercurial/merge.py	Fri Jul 24 17:31:26 2020 +0530
+++ b/mercurial/merge.py	Fri Jul 24 17:49:13 2020 +0530
@@ -513,7 +513,7 @@
         raise error.Abort(_(b"destination manifest contains path conflicts"))
 
 
-def _filternarrowactions(narrowmatch, branchmerge, actions):
+def _filternarrowactions(narrowmatch, branchmerge, mresult):
     """
     Filters out actions that can ignored because the repo is narrowed.
 
@@ -524,13 +524,13 @@
     nonconflicttypes = set(b'a am c cm f g gs r e'.split())
     # We mutate the items in the dict during iteration, so iterate
     # over a copy.
-    for f, action in list(actions.items()):
+    for f, action in list(mresult.actions.items()):
         if narrowmatch(f):
             pass
         elif not branchmerge:
-            del actions[f]  # just updating, ignore changes outside clone
+            mresult.removefile(f)  # just updating, ignore changes outside clone
         elif action[0] in nooptypes:
-            del actions[f]  # merge does not affect file
+            mresult.removefile(f)  # merge does not affect file
         elif action[0] in nonconflicttypes:
             raise error.Abort(
                 _(
@@ -950,7 +950,7 @@
     narrowmatch = repo.narrowmatch()
     if not narrowmatch.always():
         # Updates "actions" in place
-        _filternarrowactions(narrowmatch, branchmerge, mresult.actions)
+        _filternarrowactions(narrowmatch, branchmerge, mresult)
 
     renamedelete = branch_copies1.renamedelete
     renamedelete.update(branch_copies2.renamedelete)