Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 26053:b68c9d232db6
reachableroots: use internal "revstates" array to test if rev is a root
The main goal of this patch series is to reduce the use of PyXxx() function
that is likely to require ugly error handling and inc/decref. Plus, this is
faster than using PySet_Contains().
revset #0: 0::tip
0) 0.004168
1) 0.003678 88%
This patch ignores out-of-range roots as they are in the pure implementation.
Because reachable sets are calculated from heads, and out-of-range heads raise
IndexError, we can just take out-of-range roots as unreachable. Otherwise,
the test of "hg log -Gr '. + wdir()'" would fail.
"heads" argument is changed to a list. Should we have to rename the C function
as its signature is changed?
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 14 Aug 2015 15:43:29 +0900 |
parents | 1ffd97cbf9a2 |
children | 4ee2af2194d4 |
line wrap: on
line diff
--- a/mercurial/revset.py Tue Aug 18 16:40:10 2015 -0400 +++ b/mercurial/revset.py Fri Aug 14 15:43:29 2015 +0900 @@ -94,6 +94,7 @@ if not roots: return baseset() parentrevs = repo.changelog.parentrevs + roots = set(roots) visit = list(heads) reachable = set() seen = {} @@ -133,7 +134,7 @@ # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset # (and if it is not, it should.) minroot = min(roots) - roots = set(roots) + roots = list(roots) heads = list(heads) try: return repo.changelog.reachableroots(minroot, heads, roots, includepath)