commitctx: directly updated the set of removed files
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 28 Jul 2020 20:19:09 +0200
changeset 45331 027f3dd76302
parent 45330 a852e5058e69
child 45332 54eeb1a0e325
commitctx: directly updated the set of removed files The change is non-trivial so I made it in its own changeset.
mercurial/commit.py
--- 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