Patchwork [14,of,15] commitctx: directly updated the set of removed files

login
register
mail settings
Submitter Pierre-Yves David
Date July 29, 2020, 4:57 p.m.
Message ID <8a38230c8e7b189066e0.1596041864@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/46927/
State Accepted
Headers show

Comments

Pierre-Yves David - July 29, 2020, 4:57 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1595960349 -7200
#      Tue Jul 28 20:19:09 2020 +0200
# Node ID 8a38230c8e7b189066e0d58d8134228917368fd7
# Parent  d1faf95bdf57bf8d1054b2ea717d24052a7692c1
# EXP-Topic files-change
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#              hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 8a38230c8e7b
commitctx: directly updated the set of removed files

The change is non-trivial so I made it in its own changeset.

Patch

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -191,20 +191,20 @@  def _process_files(tr, ctx, error=False)
                 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