changeset 43592:61d7bca16dff

revset: simplify checkstatus() by using any() Differential Revision: https://phab.mercurial-scm.org/D7179
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 30 Oct 2019 00:00:21 -0700
parents b56c6647f65e
children ae91e4e4c9b0
files mercurial/revset.py
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Wed Nov 06 18:28:11 2019 -0800
+++ b/mercurial/revset.py	Wed Oct 30 00:00:21 2019 -0700
@@ -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))