log: use smartset.slice() to limit number of revisions to be displayed
authorYuya Nishihara <yuya@tcha.org>
Sun, 22 Oct 2017 23:04:07 +0900
changeset 35544 8494944940e5
parent 35543 a7f7eff4ec08
child 35545 349bcd7fa670
log: use smartset.slice() to limit number of revisions to be displayed
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu Jan 04 10:51:41 2018 +0900
+++ b/mercurial/cmdutil.py	Sun Oct 22 23:04:07 2017 +0900
@@ -2528,13 +2528,7 @@
         matcher = revset.match(repo.ui, expr)
         revs = matcher(repo, revs)
     if limit is not None:
-        limitedrevs = []
-        for idx, rev in enumerate(revs):
-            if idx >= limit:
-                break
-            limitedrevs.append(rev)
-        revs = smartset.baseset(limitedrevs)
-
+        revs = revs.slice(0, limit)
     return revs, expr, filematcher
 
 def _parselinerangelogopt(repo, opts):