Patchwork D7179: revset: simplify checkstatus() by using any()

login
register
mail settings
Submitter phabricator
Date Nov. 11, 2019, 12:34 p.m.
Message ID <7a629ef251a82e5506724392d19c3b48@localhost.localdomain>
Download mbox | patch
Permalink /patch/43112/
State Not Applicable
Headers show

Comments

phabricator - Nov. 11, 2019, 12:34 p.m.
Closed by commit rHG61d7bca16dff: revset: simplify checkstatus() by using any() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7179?vs=17413&id=18011

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7179/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7179

AFFECTED FILES
  mercurial/revset.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -689,19 +689,15 @@ 
             if fname not in c.files():
                 return False
         else:
-            for f in c.files():
-                if m(f):
-                    break
-            else:
+            if not any(m(f) for f in c.files()):
                 return False
         files = repo.status(c.p1().node(), c.node())[field]
         if fname is not None:
             if fname in files:
                 return True
         else:
-            for f in files:
-                if m(f):
-                    return True
+            if any(m(f) for f in files):
+                return True
 
     return subset.filter(matches, condrepr=(b'<status[%r] %r>', field, pat))