Mercurial > hg
comparison mercurial/scmutil.py @ 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 | c38a62af000e |
children | f36375576ed5 |
comparison
equal
deleted
inserted
replaced
18314:3c3855470b19 | 18315:216230643ae2 |
---|---|
861 _("unknown repository format: requires features '%s' (upgrade " | 861 _("unknown repository format: requires features '%s' (upgrade " |
862 "Mercurial)") % "', '".join(missings)) | 862 "Mercurial)") % "', '".join(missings)) |
863 return requirements | 863 return requirements |
864 | 864 |
865 class filecacheentry(object): | 865 class filecacheentry(object): |
866 def __init__(self, path): | 866 def __init__(self, path, stat=True): |
867 self.path = path | 867 self.path = path |
868 self.cachestat = filecacheentry.stat(self.path) | 868 self.cachestat = None |
869 | 869 self._cacheable = None |
870 if self.cachestat: | 870 |
871 self._cacheable = self.cachestat.cacheable() | 871 if stat: |
872 else: | 872 self.cachestat = filecacheentry.stat(self.path) |
873 # None means we don't know yet | 873 |
874 self._cacheable = None | 874 if self.cachestat: |
875 self._cacheable = self.cachestat.cacheable() | |
876 else: | |
877 # None means we don't know yet | |
878 self._cacheable = None | |
875 | 879 |
876 def refresh(self): | 880 def refresh(self): |
877 if self.cacheable(): | 881 if self.cacheable(): |
878 self.cachestat = filecacheentry.stat(self.path) | 882 self.cachestat = filecacheentry.stat(self.path) |
879 | 883 |