filecache: abstract the fetching of the list of tracked file stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 21 Sep 2021 18:02:07 +0200
branchstable
changeset 48036 1c447fb82232
parent 48035 ce01b97a93da
child 48037 016081cca1fb
filecache: abstract the fetching of the list of tracked file We will need it for a coming fix that will requires to check a variable list of file for the changelog. Differential Revision: https://phab.mercurial-scm.org/D11479
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Mon Sep 20 18:18:15 2021 +0200
+++ b/mercurial/scmutil.py	Tue Sep 21 18:02:07 2021 +0200
@@ -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: