diff mercurial/commit.py @ 48746:18e69f224e4b

narrow: add support for merging add and remove outside of the tracked set This extend f1eb77dceb36 to test and support the remaining action. Or, at least, the simple incarnation of them. Differential Revision: https://phab.mercurial-scm.org/D12181
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 03 Feb 2022 18:14:25 +0100
parents f1eb77dceb36
children 6000f5b25c9b
line wrap: on
line diff
--- a/mercurial/commit.py	Fri Jan 21 17:54:03 2022 +0100
+++ b/mercurial/commit.py	Thu Feb 03 18:14:25 2022 +0100
@@ -211,7 +211,16 @@
         repo.ui.note(uipathfn(f) + b"\n")
         if f in narrow_files:
             narrow_action = narrow_files.get(f)
-            if narrow_action == mergestate.CHANGE_MODIFIED:
+            if narrow_action == mergestate.CHANGE_REMOVED:
+                files.mark_removed(f)
+                removed.append(f)
+            elif narrow_action == mergestate.CHANGE_ADDED:
+                files.mark_added(f)
+                added.append(f)
+                m[f] = m2[f]
+                flags = m2ctx.find(f)[1] or b''
+                m.setflag(f, flags)
+            elif narrow_action == mergestate.CHANGE_MODIFIED:
                 files.mark_touched(f)
                 added.append(f)
                 m[f] = m2[f]