changeset 45283:f1fb9a079131

merge: add removefile() to mergeresult object There are cases where some further calculation makes the file not needing to be merged anymore and hence needs to be dropped in mergeresult object. This adds a function for that. Differential Revision: https://phab.mercurial-scm.org/D8821
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 24 Jul 2020 16:23:55 +0530
parents b442920ab1de
children 31c454a5f1a8
files mercurial/merge.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Fri Jul 24 16:18:39 2020 +0530
+++ b/mercurial/merge.py	Fri Jul 24 16:23:55 2020 +0530
@@ -576,6 +576,11 @@
         """
         self._actions[filename] = (action, data, message)
 
+    def removefile(self, filename):
+        """ removes a file from the mergeresult object as the file might
+        not merging anymore """
+        del self._actions[filename]
+
     @property
     def actions(self):
         return self._actions
@@ -1929,7 +1934,7 @@
                         b'prompt recreating',
                     )
                 else:
-                    del mresult.actions[f]
+                    mresult.removefile(f)
 
         # Convert to dictionary-of-lists format
         actions = mresult.actionsdict