Patchwork [7,of,7] manifest: use match.prefix() instead of 'not match.anypats()'

login
register
mail settings
Submitter Martin von Zweigbergk
Date May 21, 2015, 9:32 p.m.
Message ID <a29d1e1d2fd02cf09f25.1432243954@waste.org>
Download mbox | patch
Permalink /patch/9227/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Martin von Zweigbergk - May 21, 2015, 9:32 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1432059380 25200
#      Tue May 19 11:16:20 2015 -0700
# Node ID a29d1e1d2fd02cf09f25ccb26c1ca1cc919e01eb
# Parent  57b2ad183735e615d30fce568c3612c83fae4f42
manifest: use match.prefix() instead of 'not match.anypats()'

It seems clearer to check for what it is than what it isn't.
Augie Fackler - May 26, 2015, 2:41 p.m.
On Thu, May 21, 2015 at 04:32:34PM -0500, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1432059380 25200
> #      Tue May 19 11:16:20 2015 -0700
> # Node ID a29d1e1d2fd02cf09f25ccb26c1ca1cc919e01eb
> # Parent  57b2ad183735e615d30fce568c3612c83fae4f42
> manifest: use match.prefix() instead of 'not match.anypats()'

I've queued 1-4, 6, and 7. Will hold 5 until I get confirmation about
the commit message confusion on my end.

>
> It seems clearer to check for what it is than what it isn't.
>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -219,7 +219,7 @@
>          files instead of over manifest files.'''
>          files = match.files()
>          return (len(files) < 100 and (match.isexact() or
> -            (not match.anypats() and all(fn in self for fn in files))))
> +            (match.prefix() and all(fn in self for fn in files))))
>
>      def walk(self, match):
>          '''Generates matching file names.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -219,7 +219,7 @@ 
         files instead of over manifest files.'''
         files = match.files()
         return (len(files) < 100 and (match.isexact() or
-            (not match.anypats() and all(fn in self for fn in files))))
+            (match.prefix() and all(fn in self for fn in files))))
 
     def walk(self, match):
         '''Generates matching file names.