Patchwork [2,of,2,v2] manifest: make intersectfiles() private

login
register
mail settings
Submitter Martin von Zweigbergk
Date March 25, 2015, 8:07 p.m.
Message ID <94c7641371149eabb0b6.1427314030@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/8267/
State Accepted
Headers show

Comments

Martin von Zweigbergk - March 25, 2015, 8:07 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1427313982 25200
#      Wed Mar 25 13:06:22 2015 -0700
# Node ID 94c7641371149eabb0b6d54b7cb6f89101281fc2
# Parent  6ffdc058428df5f53cd92e0063ace45346016e2e
manifest: make intersectfiles() private

Since 0cc283f44655 (manifest: add matches() method, 2014-10-22), the
intersectfiles() method has been an implementation detail. The
treemanifest class will probably want to special-case differently and
should not have to provide intersectfiles() for API compatibility with
manifestdict(). For now, let's add a '_' prefix to indicate that it's
not part of the API.
Martin von Zweigbergk - March 25, 2015, 8:40 p.m.
I clearly didn't run the test suite before sending this. Please ignore 2/2.
Sorry.

On Wed, Mar 25, 2015 at 1:07 PM Martin von Zweigbergk <martinvonz@google.com>
wrote:

> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1427313982 25200
> #      Wed Mar 25 13:06:22 2015 -0700
> # Node ID 94c7641371149eabb0b6d54b7cb6f89101281fc2
> # Parent  6ffdc058428df5f53cd92e0063ace45346016e2e
> manifest: make intersectfiles() private
>
> Since 0cc283f44655 (manifest: add matches() method, 2014-10-22), the
> intersectfiles() method has been an implementation detail. The
> treemanifest class will probably want to special-case differently and
> should not have to provide intersectfiles() for API compatibility with
> manifestdict(). For now, let's add a '_' prefix to indicate that it's
> not part of the API.
>
> diff -r 6ffdc058428d -r 94c764137114 mercurial/manifest.py
> --- a/mercurial/manifest.py     Wed Oct 29 08:43:39 2014 -0700
> +++ b/mercurial/manifest.py     Wed Mar 25 13:06:22 2015 -0700
> @@ -131,7 +131,7 @@
>      def keys(self):
>          return list(self.iterkeys())
>
> -    def intersectfiles(self, files):
> +    def _intersectfiles(self, files):
>          '''make a new lazymanifest with the intersection of self with
> files
>
>          The algorithm assumes that files is much smaller than self.'''
> @@ -166,7 +166,7 @@
>          files = match.files()
>          if (len(files) < 100 and (match.isexact() or
>              (not match.anypats() and util.all(fn in self for fn in
> files)))):
> -            return self.intersectfiles(files)
> +            return self._intersectfiles(files)
>
>          lm = manifestdict('')
>          lm._lm = self._lm.filtercopy(match)
> @@ -467,7 +467,7 @@
>          copy._flags = dict.copy(self._flags)
>          return copy
>
> -    def intersectfiles(self, files):
> +    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.'''
> @@ -521,7 +521,7 @@
>          files = match.files()
>          if (match.isexact() or
>              (not match.anypats() and util.all(fn in self for fn in
> files))):
> -            return self.intersectfiles(files)
> +            return self._intersectfiles(files)
>
>          m = self.copy()
>          for fn in m.keys():
>

Patch

diff -r 6ffdc058428d -r 94c764137114 mercurial/manifest.py
--- a/mercurial/manifest.py	Wed Oct 29 08:43:39 2014 -0700
+++ b/mercurial/manifest.py	Wed Mar 25 13:06:22 2015 -0700
@@ -131,7 +131,7 @@ 
     def keys(self):
         return list(self.iterkeys())
 
-    def intersectfiles(self, files):
+    def _intersectfiles(self, files):
         '''make a new lazymanifest with the intersection of self with files
 
         The algorithm assumes that files is much smaller than self.'''
@@ -166,7 +166,7 @@ 
         files = match.files()
         if (len(files) < 100 and (match.isexact() or
             (not match.anypats() and util.all(fn in self for fn in files)))):
-            return self.intersectfiles(files)
+            return self._intersectfiles(files)
 
         lm = manifestdict('')
         lm._lm = self._lm.filtercopy(match)
@@ -467,7 +467,7 @@ 
         copy._flags = dict.copy(self._flags)
         return copy
 
-    def intersectfiles(self, files):
+    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.'''
@@ -521,7 +521,7 @@ 
         files = match.files()
         if (match.isexact() or
             (not match.anypats() and util.all(fn in self for fn in files))):
-            return self.intersectfiles(files)
+            return self._intersectfiles(files)
 
         m = self.copy()
         for fn in m.keys():