From patchwork Tue Sep 21 21:51:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D11479: filecache: abstract the fetching of the list of tracked file From: phabricator X-Patchwork-Id: 49796 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 21 Sep 2021 21:51:37 +0000 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 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: