[PATCH 02 of 11] revset: use `subset &` in `bookmark`

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Sep 23 17:47:48 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1411009029 25200
#      Wed Sep 17 19:57:09 2014 -0700
# Node ID 95f560abd67f59042d60e544b9a85ff25e5a642c
# Parent  a7099a4d87d791914c9a907da1add2993c00b384
revset: use `subset &` in `bookmark`

Speedup, Weeeeeee!

revset #0: bookmark()
0) wall 0.002240 comb 0.000000 user 0.000000 sys 0.000000 (best of 571)
1) wall 0.000132 comb 0.000000 user 0.000000 sys 0.000000 (best of 14059)

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -466,11 +466,11 @@ def bookmark(repo, subset, x):
                 bms.add(repo[bmrev].rev())
     else:
         bms = set([repo[r].rev()
                    for r in repo._bookmarks.values()])
     bms -= set([node.nullrev])
-    return subset.filter(bms.__contains__)
+    return subset & bms
 
 def branch(repo, subset, x):
     """``branch(string or set)``
     All changesets belonging to the given branch or the branches of the given
     changesets.


More information about the Mercurial-devel mailing list