Patchwork D11479: filecache: abstract the fetching of the list of tracked file

login
register
mail settings
Submitter phabricator
Date Sept. 21, 2021, 9:51 p.m.
Message ID <differential-rev-PHID-DREV-47z5six5rsif3w2e4ul4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49796/
State Superseded
Headers show

Comments

phabricator - Sept. 21, 2021, 9:51 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We will need it for a coming fix that will requires to check a variable list of
  file for the changelog.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1662,6 +1662,9 @@ 
     def __init__(self, *paths):
         self.paths = paths
 
+    def tracked_paths(self, obj):
+        return [self.join(obj, path) for path in self.paths]
+
     def join(self, obj, fname):
         """Used to compute the runtime path of a cached file.
 
@@ -1690,7 +1693,7 @@ 
             if entry.changed():
                 entry.obj = self.func(obj)
         else:
-            paths = [self.join(obj, path) for path in self.paths]
+            paths = self.tracked_paths(obj)
 
             # We stat -before- creating the object so our cache doesn't lie if
             # a writer modified between the time we read and stat
@@ -1709,7 +1712,7 @@ 
         if self.name not in obj._filecache:
             # we add an entry for the missing value because X in __dict__
             # implies X in _filecache
-            paths = [self.join(obj, path) for path in self.paths]
+            paths = self.tracked_paths(obj)
             ce = filecacheentry(paths, False)
             obj._filecache[self.name] = ce
         else: