[PATCH] revset-head: use '&' instead of '.filter'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Jun 20 00:37:06 CDT 2015

# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1412987409 25200
#      Fri Oct 10 17:30:09 2014 -0700
# Node ID 6eb0d76caf48d4ddc6e8d2148540b941f02223b1
# Parent  2748bf78a5bf610da4f2d90fd1eea19a3b360c04
revset-head: use '&' instead of '.filter'

More high level operations are more likely to be optimised.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1107,14 +1107,13 @@ def head(repo, subset, x):
     cl = repo.changelog
     for b, ls in repo.branchmap().iteritems():
         hs.update(cl.rev(h) for h in ls)
     # XXX using a set to feed the baseset is wrong. Sets are not ordered.
     # This does not break because of other fullreposet misbehavior.
-    # XXX We should not be using '.filter' here, but combines subset with '&'
     # XXX We should combine with subset first: 'subset & baseset(...)'. This is
     # necessary to ensure we preserve the order in subset.
-    return baseset(hs).filter(subset.__contains__)
+    return baseset(hs) & subset
 def heads(repo, subset, x):
     Members of set with no children in set.

More information about the Mercurial-devel mailing list