filecache: allow filecacheentry to be created without stating in __init__
Will be used for properties that are set without getting them first.
--- a/mercurial/scmutil.py Wed Jan 09 20:36:53 2013 +0200
+++ b/mercurial/scmutil.py Thu Jan 10 23:54:53 2013 +0200
@@ -863,15 +863,19 @@
return requirements
class filecacheentry(object):
- def __init__(self, path):
+ def __init__(self, path, stat=True):
self.path = path
- self.cachestat = filecacheentry.stat(self.path)
+ self.cachestat = None
+ self._cacheable = None
- if self.cachestat:
- self._cacheable = self.cachestat.cacheable()
- else:
- # None means we don't know yet
- self._cacheable = None
+ if stat:
+ self.cachestat = filecacheentry.stat(self.path)
+
+ if self.cachestat:
+ self._cacheable = self.cachestat.cacheable()
+ else:
+ # None means we don't know yet
+ self._cacheable = None
def refresh(self):
if self.cacheable():