##// 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

File last commit:

r28827:1e184241 default
r33080:a53bfc28 default
Show More
map-cmdline.compact
30 lines | 1006 B | text/plain | TextLexer
ldate = '{label("log.date",
"{date|isodate}")}'
ldesc = '{label('ui.note log.description',
'{desc|strip}')}'
ldescfirst = '{label('ui.note log.description',
'{desc|firstline|strip}')}'
changeset = '{lrev}{tags}{bookmarks}{parents} {lnode} {ldate} {luser}\n {ldescfirst}\n\n'
changeset_quiet = '{lrev}:{lnode}\n'
changeset_verbose = '{lrev}{tags}{parents} {lnode} {ldate} {lauthor}\n {ldesc}\n\n'
lrev = '{label("log.changeset changeset.{phase}",
"{rev}")}'
lnode = '{label("log.node",
"{node|short}")}'
lauthor = '{label("log.user",
"{author}")}'
luser = '{label("log.user",
"{author|user}")}'
start_tags = '['
tag = '{label("log.tag",
"{tag},")}'
last_tag = '{tag}]'
start_parents = ':'
parent = '{lrev},'
last_parent = '{lrev}'
start_bookmarks = '['
bookmark = '{label("log.bookmark",
"{bookmark},")}'
last_bookmark = '{bookmark}]'