Patchwork D8589: metadata: filter the `removed` set to only contains relevant data

login
register
mail settings
Submitter phabricator
Date May 27, 2020, 1:17 p.m.
Message ID <differential-rev-PHID-DREV-kuvl4ezwkxjrgly3eezu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46380/
State Superseded
Headers show

Comments

phabricator - May 27, 2020, 1:17 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The `files` entry can be bogus and contains too many entries. This can badly
  combines with the computation of `removed` inflating the set size. The can lead
  to the changesets centric rename computation to process much more data than
  needed, slowing it down (and increasing space taken by data storage).
  
  In practice newer commits already that reduced set, this applies this "fix" to
  older changeset.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8589

AFFECTED FILES
  mercurial/metadata.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/metadata.py b/mercurial/metadata.py
--- a/mercurial/metadata.py
+++ b/mercurial/metadata.py
@@ -94,6 +94,9 @@ 
     for f in ctx.files():
         if f not in ctx:
             removed.append(f)
+    if removed:
+        rf = get_removal_filter(ctx)
+        removed = [r for r in removed if not rf(r)]
     return removed