Patchwork [2,of,4] treemanifest: remove treemanifest._intersectfiles()

login
register
mail settings
Submitter Drew Gottlieb
Date March 31, 2015, 10:29 p.m.
Message ID <3e59a573b043f2e39334.1427840952@waste.org>
Download mbox | patch
Permalink /patch/8400/
State Accepted
Commit 4daae7edf166b9b126d0dfee3d7b593b3b9d6586
Headers show

Comments

Drew Gottlieb - March 31, 2015, 10:29 p.m.
# HG changeset patch
# User Drew Gottlieb <drgott@google.com>
# Date 1427487373 25200
#      Fri Mar 27 13:16:13 2015 -0700
# Node ID 3e59a573b043f2e39334347232bf9def2acba801
# Parent  bb9449558e313c14d8777e11f0f22bbc19b6fc30
treemanifest: remove treemanifest._intersectfiles()

In preparation for the optimization in the following commit, this commit
removes treemanifest.matches()'s call to _intersectfiles(), and removes
_intersectfiles() itself since it's unused at this point.

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -480,19 +480,6 @@ 
         copy._flags = dict.copy(self._flags)
         return copy
 
-    def _intersectfiles(self, files):
-        '''make a new treemanifest with the intersection of self with files
-
-        The algorithm assumes that files is much smaller than self.'''
-        ret = treemanifest()
-        for fn in files:
-            if fn in self:
-                ret[fn] = self[fn]
-                flags = self.flags(fn)
-                if flags:
-                    ret.setflag(fn, flags)
-        return ret
-
     def filesnotin(self, m2):
         '''Set of files in this manifest that are not in the other'''
         files = set()
@@ -531,11 +518,6 @@ 
         if match.always():
             return self.copy()
 
-        files = match.files()
-        if (match.isexact() or
-            (not match.anypats() and util.all(fn in self for fn in files))):
-            return self._intersectfiles(files)
-
         m = self.copy()
         for fn in m.keys():
             if not match(fn):