[PATCH 2 of 6] log: use smartset.slice() to limit number of revisions to be displayed

Yuya Nishihara yuya at tcha.org
Thu Jan 4 03:36:43 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1508681047 -32400
#      Sun Oct 22 23:04:07 2017 +0900
# Node ID dfe3c291d4011a5e15277f7fdb234a71c504a1a1
# Parent  340e4b15e4e6d6d020d2c7d8f8683c7c11598925
log: use smartset.slice() to limit number of revisions to be displayed

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2528,13 +2528,7 @@ def getlogrevs(repo, pats, opts):
         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):


More information about the Mercurial-devel mailing list