##// END OF EJS Templates
context: re-add `overlayworkingctx._compact()` removed in 6a5dcd754842...
Manuel Jacob -
r45798:1476ec96 stable
parent child Browse files
Show More
@@ -2530,6 +2530,43 b' class overlayworkingctx(committablectx):'
2530 def clean(self):
2530 def clean(self):
2531 self._cache = {}
2531 self._cache = {}
2532
2532
2533 def _compact(self):
2534 """Removes keys from the cache that are actually clean, by comparing
2535 them with the underlying context.
2536
2537 This can occur during the merge process, e.g. by passing --tool :local
2538 to resolve a conflict.
2539 """
2540 keys = []
2541 # This won't be perfect, but can help performance significantly when
2542 # using things like remotefilelog.
2543 scmutil.prefetchfiles(
2544 self.repo(),
2545 [
2546 (
2547 self.p1().rev(),
2548 scmutil.matchfiles(self.repo(), self._cache.keys()),
2549 )
2550 ],
2551 )
2552
2553 for path in self._cache.keys():
2554 cache = self._cache[path]
2555 try:
2556 underlying = self._wrappedctx[path]
2557 if (
2558 underlying.data() == cache[b'data']
2559 and underlying.flags() == cache[b'flags']
2560 ):
2561 keys.append(path)
2562 except error.ManifestLookupError:
2563 # Path not in the underlying manifest (created).
2564 continue
2565
2566 for path in keys:
2567 del self._cache[path]
2568 return keys
2569
2533 def _markdirty(
2570 def _markdirty(
2534 self, path, exists, data=None, date=None, flags=b'', copied=None
2571 self, path, exists, data=None, date=None, flags=b'', copied=None
2535 ):
2572 ):
General Comments 0
You need to be logged in to leave comments. Login now