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

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 4, 2018, 8:36 a.m.
Message ID <dfe3c291d4011a5e1527.1515055003@mimosa>
Download mbox | patch
Permalink /patch/26531/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 4, 2018, 8:36 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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

Patch

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):