+ def _compact(self):
+ """Removes keys from the cache that are actually clean, by comparing
+ them with the underlying context.
+ This can occur during the merge process, e.g. by passing --tool :local
+ to resolve a conflict.
+ keys = 
+ # This won't be perfect, but can help performance significantly when
+ # using things like remotefilelog.
+ scmutil.matchfiles(self.repo(), self._cache.keys()),
+ for path in self._cache.keys():
+ cache = self._cache[path]
+ underlying = self._wrappedctx[path]
+ if (
+ underlying.data() == cache[b'data']
+ and underlying.flags() == cache[b'flags']
+ except error.ManifestLookupError:
+ # Path not in the underlying manifest (created).
+ for path in keys:
+ del self._cache[path]
+ return keys
self, path, exists, data=None, date=None, flags=b'', copied=None