##// END OF EJS Templates
overlayworkingctx: add `_checkexist(path)`...
Phil Cohen -
r35296:bea46aed default
parent child Browse files
Show More
@@ -2045,6 +2045,16 b' class overlayworkingctx(workingctx):'
2045 else:
2045 else:
2046 return self._wrappedctx[path].flags()
2046 return self._wrappedctx[path].flags()
2047
2047
2048 def _existsinparent(self, path):
2049 try:
2050 # ``commitctx` raises a ``ManifestLookupError`` if a path does not
2051 # exist, unlike ``workingctx``, which returns a ``workingfilectx``
2052 # with an ``exists()`` function.
2053 self._wrappedctx[path]
2054 return True
2055 except error.ManifestLookupError:
2056 return False
2057
2048 def write(self, path, data, flags=''):
2058 def write(self, path, data, flags=''):
2049 if data is None:
2059 if data is None:
2050 raise error.ProgrammingError("data must be non-None")
2060 raise error.ProgrammingError("data must be non-None")
@@ -2070,13 +2080,15 b' class overlayworkingctx(workingctx):'
2070 return self.exists(self._cache[path]['data'].strip())
2080 return self.exists(self._cache[path]['data'].strip())
2071 else:
2081 else:
2072 return self._cache[path]['exists']
2082 return self._cache[path]['exists']
2073 return self._wrappedctx[path].exists()
2083
2084 return self._existsinparent(path)
2074
2085
2075 def lexists(self, path):
2086 def lexists(self, path):
2076 """lexists returns True if the path exists"""
2087 """lexists returns True if the path exists"""
2077 if self.isdirty(path):
2088 if self.isdirty(path):
2078 return self._cache[path]['exists']
2089 return self._cache[path]['exists']
2079 return self._wrappedctx[path].lexists()
2090
2091 return self._existsinparent(path)
2080
2092
2081 def size(self, path):
2093 def size(self, path):
2082 if self.isdirty(path):
2094 if self.isdirty(path):
General Comments 0
You need to be logged in to leave comments. Login now