# HG changeset patch # User Augie Fackler # Date 1580939930 18000 # Node ID bbecb6d80aa72ba3f8b4bfb3c853697b2cbb466b # Parent 63d84c18247ae6adda88c4e1755560750a721a93 manifest: rewrite filesnotin to not make superfluous manifest copies This also skips using diff() when all we care about is the filenames. I'm expecting the built in set logic to be plenty fast. For really large manifests with a matcher in play this should copy substantially less data around. Differential Revision: https://phab.mercurial-scm.org/D8082 diff -r 63d84c18247a -r bbecb6d80aa7 mercurial/manifest.py --- a/mercurial/manifest.py Sat Feb 08 03:13:45 2020 +0530 +++ b/mercurial/manifest.py Wed Feb 05 16:58:50 2020 -0500 @@ -23,6 +23,7 @@ from . import ( encoding, error, + match as matchmod, mdiff, pathutil, policy, @@ -482,17 +483,11 @@ def filesnotin(self, m2, match=None): '''Set of files in this manifest that are not in the other''' - if match: - m1 = self.matches(match) - m2 = m2.matches(match) - return m1.filesnotin(m2) - diff = self.diff(m2) - files = set( - filepath - for filepath, hashflags in pycompat.iteritems(diff) - if hashflags[1][0] is None - ) - return files + if match is not None: + match = matchmod.badmatch(match, lambda path, msg: None) + sm2 = set(m2.walk(match)) + return {f for f in self.walk(match) if f not in sm2} + return {f for f in self if f not in m2} @propertycache def _dirs(self):