Mercurial > hg
comparison mercurial/cmdutil.py @ 35544:8494944940e5
log: use smartset.slice() to limit number of revisions to be displayed
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 22 Oct 2017 23:04:07 +0900 |
parents | a7f7eff4ec08 |
children | 349bcd7fa670 |
comparison
equal
deleted
inserted
replaced
35543:a7f7eff4ec08 | 35544:8494944940e5 |
---|---|
2526 revs.sort(reverse=True) | 2526 revs.sort(reverse=True) |
2527 if expr: | 2527 if expr: |
2528 matcher = revset.match(repo.ui, expr) | 2528 matcher = revset.match(repo.ui, expr) |
2529 revs = matcher(repo, revs) | 2529 revs = matcher(repo, revs) |
2530 if limit is not None: | 2530 if limit is not None: |
2531 limitedrevs = [] | 2531 revs = revs.slice(0, limit) |
2532 for idx, rev in enumerate(revs): | |
2533 if idx >= limit: | |
2534 break | |
2535 limitedrevs.append(rev) | |
2536 revs = smartset.baseset(limitedrevs) | |
2537 | |
2538 return revs, expr, filematcher | 2532 return revs, expr, filematcher |
2539 | 2533 |
2540 def _parselinerangelogopt(repo, opts): | 2534 def _parselinerangelogopt(repo, opts): |
2541 """Parse --line-range log option and return a list of tuples (filename, | 2535 """Parse --line-range log option and return a list of tuples (filename, |
2542 (fromline, toline)). | 2536 (fromline, toline)). |