Patchwork [03,of,11] revset: use `subset &` in `ancestorspec`

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 23, 2014, 10:47 p.m.
Message ID <9b7673d405d4a9f5d386.1411512469@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5935/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 23, 2014, 10:47 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1410976667 25200
#      Wed Sep 17 10:57:47 2014 -0700
# Node ID 9b7673d405d4a9f5d386844e074a6c02a73c4ea2
# Parent  95f560abd67f59042d60e544b9a85ff25e5a642c
revset: use `subset &` in `ancestorspec`

This take advantage of the `fullreposet` smartness


revset #0: tip~25
0) wall 0.004800 comb 0.010000 user 0.010000 sys 0.000000 (best of 259)
1) wall 0.002475 comb 0.000000 user 0.000000 sys 0.000000 (best of 717)

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -374,11 +374,11 @@  def ancestorspec(repo, subset, x, n):
     cl = repo.changelog
     for r in getset(repo, baseset(cl), x):
         for i in range(n):
             r = cl.parentrevs(r)[0]
         ps.add(r)
-    return subset.filter(ps.__contains__)
+    return subset & ps
 
 def author(repo, subset, x):
     """``author(string)``
     Alias for ``user(string)``.
     """