[PATCH] manifest: improve filesnotin performance by using lazymanifest diff

Tony Tung ttung at fb.com
Wed Apr 27 03:23:47 EDT 2016


# HG changeset patch
# User Tony Tung <tonytung at merly.org>
# Date 1461740718 25200
#      Wed Apr 27 00:05:18 2016 -0700
# Branch stable
# Node ID 7f80dce78781f5fe691a23f1b7f5a110ed170f32
# Parent  97811ff7964710d32cae951df1da8019b46151a2
manifest: improve filesnotin performance by using lazymanifest diff

lazymanifests can compute diffs significantly faster than taking the set
of two manifests and calculating the delta.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -211,8 +211,10 @@
 
     def filesnotin(self, m2):
         '''Set of files in this manifest that are not in the other'''
-        files = set(self)
-        files.difference_update(m2)
+        diff = self.diff(m2)
+        files = set(filepath
+                    for filepath, hashflags in diff.items()
+                    if hashflags[1][0] is None)
         return files
 
     @propertycache


More information about the Mercurial-devel mailing list