comparison mercurial/revset.py @ 26001:748053b4a66b

revset: make revsbetween public This patch is part of a series of patches to speed up the computation of revset.revsbetween by introducing a C implementation. The main motivation is to speed up smartlog on big repositories. At the end of the series, on our big repositories the computation of revsbetween is 10-50x faster and smartlog on is 2x-5x faster. Later in this serie, we want to reuse the implementation of revsbetween in the changelog module, therefore, we make it public.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 07 Aug 2015 02:13:42 -0700
parents a7527c5769bb
children fd92bfbbe02d
comparison
equal deleted inserted replaced
25999:1c75249e159b 26001:748053b4a66b
85 yield i 85 yield i
86 break 86 break
87 87
88 return generatorset(iterate(), iterasc=True) 88 return generatorset(iterate(), iterasc=True)
89 89
90 def _revsbetween(repo, roots, heads): 90 def revsbetween(repo, roots, heads):
91 """Return all paths between roots and heads, inclusive of both endpoint 91 """Return all paths between roots and heads, inclusive of both endpoint
92 sets.""" 92 sets."""
93 if not roots: 93 if not roots:
94 return baseset() 94 return baseset()
95 parentrevs = repo.changelog.parentrevs 95 parentrevs = repo.changelog.parentrevs
404 # would be more efficient. 404 # would be more efficient.
405 return r & subset 405 return r & subset
406 406
407 def dagrange(repo, subset, x, y): 407 def dagrange(repo, subset, x, y):
408 r = fullreposet(repo) 408 r = fullreposet(repo)
409 xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y)) 409 xs = revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
410 # XXX We should combine with subset first: 'subset & baseset(...)'. This is 410 # XXX We should combine with subset first: 'subset & baseset(...)'. This is
411 # necessary to ensure we preserve the order in subset. 411 # necessary to ensure we preserve the order in subset.
412 return xs & subset 412 return xs & subset
413 413
414 def andset(repo, subset, x, y): 414 def andset(repo, subset, x, y):