changeset 18315:216230643ae2

filecache: allow filecacheentry to be created without stating in __init__ Will be used for properties that are set without getting them first.
author Idan Kamara <idankk86@gmail.com>
date Thu, 10 Jan 2013 23:54:53 +0200
parents 3c3855470b19
children f36375576ed5
files mercurial/scmutil.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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():