filecache: allow filecacheentry to be created without stating in __init__
authorIdan Kamara <idankk86@gmail.com>
Thu, 10 Jan 2013 23:54:53 +0200
changeset 18315 216230643ae2
parent 18314 3c3855470b19
child 18316 f36375576ed5
filecache: allow filecacheentry to be created without stating in __init__ Will be used for properties that are set without getting them first.
mercurial/scmutil.py
--- 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():