##// END OF EJS Templates
overlayworkingctx: add `_compact()`...
Phil Cohen -
r35327:dc9da4f4 default
parent child Browse files
Show More
@@ -2225,6 +2225,29 class overlayworkingctx(committablectx):
2225 2225 def clean(self):
2226 2226 self._cache = {}
2227 2227
2228 def _compact(self):
2229 """Removes keys from the cache that are actually clean, by comparing
2230 them with the underlying context.
2231
2232 This can occur during the merge process, e.g. by passing --tool :local
2233 to resolve a conflict.
2234 """
2235 keys = []
2236 for path in self._cache.keys():
2237 cache = self._cache[path]
2238 try:
2239 underlying = self._wrappedctx[path]
2240 if (underlying.data() == cache['data'] and
2241 underlying.flags() == cache['flags']):
2242 keys.append(path)
2243 except error.ManifestLookupError:
2244 # Path not in the underlying manifest (created).
2245 continue
2246
2247 for path in keys:
2248 del self._cache[path]
2249 return keys
2250
2228 2251 def _markdirty(self, path, exists, data=None, date=None, flags=''):
2229 2252 self._cache[path] = {
2230 2253 'exists': exists,
General Comments 0
You need to be logged in to leave comments. Login now