Mercurial > hg-stable
changeset 20043:88bd8df008f2
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.)
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sat, 16 Nov 2013 13:19:06 -0800 |
parents | 9a72d3886888 |
children | d38de18d187a |
files | mercurial/scmutil.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmutil.py Sat Nov 16 13:33:33 2013 -0800 +++ b/mercurial/scmutil.py Sat Nov 16 13:19:06 2013 -0800 @@ -713,14 +713,14 @@ "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 @@ 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 @@ 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 @@ # 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 @@ 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]