# HG changeset patch # User Siddharth Agarwal # Date 2013-11-16 21:19:06 # Node ID 88bd8df008f2aea197d878ea8f49ae5906dc67ab # Parent 9a72d38868884b2db18528b451412c2e6418ac1e scmutil: rename filecacheentry to filecachesubentry Upcoming patches will allow the file cache to watch over multiple files, and call the decorated function again if any of the files change. The particular use case for this is the bookmark store, which needs to be invalidated if either .hg/bookmarks or .hg/bookmarks.current changes. (This doesn't currently happen, which is a bug. This bug will also be fixed in upcoming patches.) diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -713,14 +713,14 @@ def readrequires(opener, supported): "Mercurial)") % "', '".join(missings)) return requirements -class filecacheentry(object): +class filecachesubentry(object): def __init__(self, path, stat): self.path = path self.cachestat = None self._cacheable = None if stat: - self.cachestat = filecacheentry.stat(self.path) + self.cachestat = filecachesubentry.stat(self.path) if self.cachestat: self._cacheable = self.cachestat.cacheable() @@ -730,7 +730,7 @@ class filecacheentry(object): def refresh(self): if self.cacheable(): - self.cachestat = filecacheentry.stat(self.path) + self.cachestat = filecachesubentry.stat(self.path) def cacheable(self): if self._cacheable is not None: @@ -744,7 +744,7 @@ class filecacheentry(object): if not self.cacheable(): return True - newstat = filecacheentry.stat(self.path) + newstat = filecachesubentry.stat(self.path) # we may not know if it's cacheable yet, check again now if newstat and self._cacheable is None: @@ -814,7 +814,7 @@ class filecache(object): # We stat -before- creating the object so our cache doesn't lie if # a writer modified between the time we read and stat - entry = filecacheentry(path, True) + entry = filecachesubentry(path, True) entry.obj = self.func(obj) obj._filecache[self.name] = entry @@ -826,7 +826,7 @@ class filecache(object): if self.name not in obj._filecache: # we add an entry for the missing value because X in __dict__ # implies X in _filecache - ce = filecacheentry(self.join(obj, self.path), False) + ce = filecachesubentry(self.join(obj, self.path), False) obj._filecache[self.name] = ce else: ce = obj._filecache[self.name]