overlayworkingctx: remove unused `nofilechanges()` and `_compact()` methods
authorManuel Jacob <me@manueljacob.de>
Sat, 11 Jul 2020 03:17:42 +0200
changeset 45091 6a5dcd754842
parent 45090 0ecb3b11fcad
child 45093 63196198dbf0
overlayworkingctx: remove unused `nofilechanges()` and `_compact()` methods Differential Revision: https://phab.mercurial-scm.org/D8733
mercurial/context.py
--- a/mercurial/context.py	Sat Jul 11 03:10:23 2020 +0200
+++ b/mercurial/context.py	Sat Jul 11 03:17:42 2020 +0200
@@ -2527,52 +2527,9 @@
     def isdirty(self, path):
         return path in self._cache
 
-    def nofilechanges(self):
-        # We need to discard any keys that are actually clean before the empty
-        # commit check.
-        self._compact()
-        return len(self._cache) == 0
-
     def clean(self):
         self._cache = {}
 
-    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.prefetchfiles(
-            self.repo(),
-            [
-                (
-                    self.p1().rev(),
-                    scmutil.matchfiles(self.repo(), self._cache.keys()),
-                )
-            ],
-        )
-
-        for path in self._cache.keys():
-            cache = self._cache[path]
-            try:
-                underlying = self._wrappedctx[path]
-                if (
-                    underlying.data() == cache[b'data']
-                    and underlying.flags() == cache[b'flags']
-                ):
-                    keys.append(path)
-            except error.ManifestLookupError:
-                # Path not in the underlying manifest (created).
-                continue
-
-        for path in keys:
-            del self._cache[path]
-        return keys
-
     def _markdirty(
         self, path, exists, data=None, date=None, flags=b'', copied=None
     ):