##// END OF EJS Templates
revset: add depth limit to descendants() (issue5374)...
revset: add depth limit to descendants() (issue5374) This is naive implementation using two-pass scanning. Tracking descendants isn't an easy problem if both start and stop depths are specified. It's impractical to remember all possible depths of each node while scanning from roots to descendants because the number of depths explodes. Instead, we could cache (min, max) depths as a good approximation and track ancestors back when needed, but that's likely to have off-by-one bug. Since this implementation appears not significantly slower, and is quite straightforward, I think it's good enough for practical use cases. The time and space complexity is O(n) ish. revisions: 0) 1-pass scanning with (min, max)-depth cache (worst-case quadratic) 1) 2-pass scanning (this version) repository: mozilla-central # descendants(0) (for reference) *) 0.430353 # descendants(0, depth=1000) 0) 0.264889 1) 0.398289 # descendants(limit(tip:0, 1, offset=10000), depth=1000) 0) 0.025478 1) 0.029099 # descendants(0, depth=2000, startdepth=1000) 0) painfully slow (due to quadratic backtracking of ancestors) 1) 1.531138
Yuya Nishihara -
r33080:a53bfc28 default
Show More
Name Size Modified Last Commit Author
/ mercurial / help
internals
bundlespec.txt Loading ...
color.txt Loading ...
common.txt Loading ...
config.txt Loading ...
dates.txt Loading ...
diffs.txt Loading ...
environment.txt Loading ...
extensions.txt Loading ...
filesets.txt Loading ...
glossary.txt Loading ...
hg-ssh.8.txt Loading ...
hg.1.txt Loading ...
hgignore.5.txt Loading ...
hgignore.txt Loading ...
hgrc.5.txt Loading ...
hgweb.txt Loading ...
merge-tools.txt Loading ...
pager.txt Loading ...
patterns.txt Loading ...
phases.txt Loading ...
revisions.txt Loading ...
scripting.txt Loading ...
subrepos.txt Loading ...
templates.txt Loading ...
urls.txt Loading ...