Patchwork changectx.walk: drop unnecessary call to match function

login
register
mail settings
Submitter Martin von Zweigbergk
Date April 7, 2015, 12:07 a.m.
Message ID <2f8f7cc6a53b3da4b917.1428365253@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/8517/
State Accepted
Commit 2f8f7cc6a53b3da4b917a115a3b4da8eb9025757
Headers show

Comments

Martin von Zweigbergk - April 7, 2015, 12:07 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1428365015 25200
#      Mon Apr 06 17:03:35 2015 -0700
# Node ID 2f8f7cc6a53b3da4b917a115a3b4da8eb9025757
# Parent  b2fb1403994e033584aed8a487ab162a9d75fa80
changectx.walk: drop unnecessary call to match function

If all the files in match.files() are in the context/manifest, we
already know that the matcher will match each file.
Augie Fackler - April 9, 2015, 3:22 p.m.
On Mon, Apr 06, 2015 at 05:07:33PM -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1428365015 25200
> #      Mon Apr 06 17:03:35 2015 -0700
> # Node ID 2f8f7cc6a53b3da4b917a115a3b4da8eb9025757
> # Parent  b2fb1403994e033584aed8a487ab162a9d75fa80
> changectx.walk: drop unnecessary call to match function

This was pushed as 2f8f7cc6a53b, FYI.

>
> If all the files in match.files() are in the context/manifest, we
> already know that the matcher will match each file.
>
> diff -r b2fb1403994e -r 2f8f7cc6a53b mercurial/context.py
> --- a/mercurial/context.py	Mon Apr 06 17:16:55 2015 -0500
> +++ b/mercurial/context.py	Mon Apr 06 17:03:35 2015 -0700
> @@ -592,8 +592,7 @@
>          if fset and not match.anypats():
>              if util.all(fn in self for fn in fset):
>                  for fn in sorted(fset):
> -                    if match(fn):
> -                        yield fn
> +                    yield fn
>                  raise StopIteration
>
>          for fn in self:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r b2fb1403994e -r 2f8f7cc6a53b mercurial/context.py
--- a/mercurial/context.py	Mon Apr 06 17:16:55 2015 -0500
+++ b/mercurial/context.py	Mon Apr 06 17:03:35 2015 -0700
@@ -592,8 +592,7 @@ 
         if fset and not match.anypats():
             if util.all(fn in self for fn in fset):
                 for fn in sorted(fset):
-                    if match(fn):
-                        yield fn
+                    yield fn
                 raise StopIteration
 
         for fn in self: