[PATCH 4 of 5] revset-parentspec: call `getset` on a `fullreposet`

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Oct 17 12:49:30 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1413526506 25200
#      Thu Oct 16 23:15:06 2014 -0700
# Node ID 954383f603744d8408a0c5118a25335b88aa8773
# Parent  bdcaab9d99c21ac793437f1ad90cb1a9cb8033e7
revset-parentspec: 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^1
before) wall 0.002694 comb 0.000000 user 0.000000 sys 0.000000 (best of 897)
after)  wall 0.000997 comb 0.000000 user 0.000000 sys 0.000000 (best of 2324)

revset) parents(100)^1
before) wall 0.003832 comb 0.000000 user 0.000000 sys 0.000000 (best of 587)
after)  wall 0.001034 comb 0.000000 user 0.000000 sys 0.000000 (best of 2309)

revset) (100^1)^1
before) wall 0.005616 comb 0.000000 user 0.000000 sys 0.000000 (best of 405)
after)  wall 0.001030 comb 0.000000 user 0.000000 sys 0.000000 (best of 2258)

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1257,11 +1257,11 @@ def parentspec(repo, subset, x, n):
             raise ValueError
     except (TypeError, ValueError):
         raise error.ParseError(_("^ expects a number 0, 1, or 2"))
     ps = set()
     cl = repo.changelog
-    for r in getset(repo, baseset(cl), x):
+    for r in getset(repo, fullreposet(repo), x):
         if n == 0:
             ps.add(r)
         elif n == 1:
             ps.add(cl.parentrevs(r)[0])
         elif n == 2:


More information about the Mercurial-devel mailing list