[PATCH] revset: replace for-loop with list comprehension

Idan Kamara idankk86 at gmail.com
Thu Apr 7 08:28:35 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1302182440 -10800
# Node ID 508d5419529cebd13897f7efc23ad365fb74125f
# Parent  a1e418070ff60d7ca02cf8e14ef807691aa3d0db
revset: replace for-loop with list comprehension

diff -r a1e418070ff6 -r 508d5419529c mercurial/revset.py
--- a/mercurial/revset.py	Thu Apr 07 11:40:54 2011 +0200
+++ b/mercurial/revset.py	Thu Apr 07 16:20:40 2011 +0300
@@ -698,11 +698,7 @@
     if state not in ('good', 'bad', 'skip', 'unknown'):
         raise ParseError(_('invalid bisect state'))
     marked = set(repo.changelog.rev(n) for n in hbisect.load_state(repo)[state])
-    l = []
-    for r in subset:
-        if r in marked:
-            l.append(r)
-    return l
+    return [r for r in subset if r in marked]
 
 symbols = {
     "adds": adds,


More information about the Mercurial-devel mailing list