Patchwork [4,of,4] manifest.walk: join nested if-conditions

login
register
mail settings
Submitter Martin von Zweigbergk
Date April 8, 2015, 7:58 p.m.
Message ID <3d4cfad760d58cd96809.1428523085@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/8562/
State Accepted
Headers show

Comments

Martin von Zweigbergk - April 8, 2015, 7:58 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1428471344 25200
#      Tue Apr 07 22:35:44 2015 -0700
# Node ID 3d4cfad760d58cd96809ed93c23822f0e47ed9e5
# Parent  0ea055b50b25af563a7f0956acf6ee465217f10b
manifest.walk: join nested if-conditions

This makes it more closely match the similar condition in
manifestdict.matches().
Matt Mackall - April 8, 2015, 8:27 p.m.
On Wed, 2015-04-08 at 12:58 -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1428471344 25200
> #      Tue Apr 07 22:35:44 2015 -0700
> # Node ID 3d4cfad760d58cd96809ed93c23822f0e47ed9e5
> # Parent  0ea055b50b25af563a7f0956acf6ee465217f10b
> manifest.walk: join nested if-conditions

These are queued for default, thanks.

Patch

diff -r 0ea055b50b25 -r 3d4cfad760d5 mercurial/manifest.py
--- a/mercurial/manifest.py	Wed Apr 08 10:01:31 2015 -0700
+++ b/mercurial/manifest.py	Tue Apr 07 22:35:44 2015 -0700
@@ -225,11 +225,10 @@ 
         fset = set(match.files())
 
         # avoid the entire walk if we're only looking for specific files
-        if fset and not match.anypats():
-            if util.all(fn in self for fn in fset):
-                for fn in sorted(fset):
-                    yield fn
-                raise StopIteration
+        if fset and not match.anypats() and util.all(fn in self for fn in fset):
+            for fn in sorted(fset):
+                yield fn
+            raise StopIteration
 
         for fn in self:
             if fn in fset: