changeset 45352:027f3dd76302

commitctx: directly updated the set of removed files The change is non-trivial so I made it in its own changeset.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 28 Jul 2020 20:19:09 +0200
parents a852e5058e69
children 54eeb1a0e325
files mercurial/commit.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commit.py	Wed Jul 29 16:48:31 2020 +0200
+++ b/mercurial/commit.py	Tue Jul 28 20:19:09 2020 +0200
@@ -191,20 +191,20 @@
                 repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f))
             raise
 
+    files = metadata.ChangingFiles(touched=touched, added=filesadded)
     # update manifest
     removed = [f for f in removed if f in m1 or f in m2]
     drop = sorted([f for f in removed if f in m])
     for f in drop:
         del m[f]
-    if p2.rev() != nullrev:
+    if p2.rev() == nullrev:
+        files.update_removed(removed)
+    else:
         rf = metadata.get_removal_filter(ctx, (p1, p2, m1, m2))
-        removed = [f for f in removed if not rf(f)]
+        for f in removed:
+            if not rf(f):
+                files.mark_removed(f)
 
-    touched.extend(removed)
-
-    files = metadata.ChangingFiles(
-        touched=touched, added=filesadded, removed=removed
-    )
     mn = _commit_manifest(tr, linkrev, ctx, mctx, m, files.touched, added, drop)
 
     return mn, files