Patchwork D8082: manifest: rewrite filesnotin to not make superfluous manifest copies

login
register
mail settings
Submitter phabricator
Date Feb. 7, 2020, 10:11 p.m.
Message ID <65596e999555f63bf38cd078482e9f82@localhost.localdomain>
Download mbox | patch
Permalink /patch/45040/
State Not Applicable
Headers show

Comments

phabricator - Feb. 7, 2020, 10:11 p.m.
Closed by commit rHGa4e045740619: manifest: rewrite filesnotin to not make superfluous manifest copies (authored by durin42).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D8082?vs=19925&id=20005#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8082?vs=19925&id=20005

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8082/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8082

AFFECTED FILES
  mercurial/manifest.py

CHANGE DETAILS




To: durin42, #hg-reviewers, martinvonz
Cc: mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -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):