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

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Sep 21 21:51:37 UTC 2021


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

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:



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


More information about the Mercurial-devel mailing list