Patchwork [2,of,5] revset-ancestorspec: call `getset` on a `fullreposet`

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 17, 2014, 5:49 p.m.
Message ID <088da6eacbda46121b3d.1413568168@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6373/
State Deferred
Headers show

Comments

Pierre-Yves David - Oct. 17, 2014, 5:49 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1413526285 25200
#      Thu Oct 16 23:11:25 2014 -0700
# Node ID 088da6eacbda46121b3dc3dae6c5509dfd9ea474
# Parent  90c7efa25968d3a4aa67f13bc52cb334ce99ef07
revset-ancestorspec: call `getset` on a `fullreposet`

Calling `baseset(repo.changelog)` build a list for all revisions in the repo. And
we already have the lazy and efficient `fullreposet` class for this purpose.

This gives us the usual benefits of the fullreposet:

revset) 100~5
before) wall 0.002712 comb 0.000000 user 0.000000 sys 0.000000 (best of 918)
after)  wall 0.000996 comb 0.000000 user 0.000000 sys 0.000000 (best of 2493)

revset) parents(100)~5
before) wall 0.003812 comb 0.010000 user 0.010000 sys 0.000000 (best of 667)
after)  wall 0.001038 comb 0.000000 user 0.000000 sys 0.000000 (best of 2361)

revset) (100~5)~5
before) wall 0.005614 comb 0.000000 user 0.000000 sys 0.000000 (best of 446)
after)  wall 0.001035 comb 0.000000 user 0.000000 sys 0.000000 (best of 2424)

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -368,11 +368,11 @@  def ancestorspec(repo, subset, x, n):
         n = int(n[1])
     except (TypeError, ValueError):
         raise error.ParseError(_("~ expects a number"))
     ps = set()
     cl = repo.changelog
-    for r in getset(repo, baseset(cl), x):
+    for r in getset(repo, fullreposet(repo), x):
         for i in range(n):
             r = cl.parentrevs(r)[0]
         ps.add(r)
     return subset & ps