[PATCH 4 of 5 🍦] revset-parentspec: call `getset` on a `fullreposet`
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sun Nov 2 05:46:08 CST 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 029413a414a56691690eb404ccb22d32b16b5800
# Parent 92c5ce5270e693c1c2c12afa1d2f6c4a5e4b5b32
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
@@ -1255,11 +1255,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