Patchwork [3,of,6] log: remove redundant handling of --limit

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

Comments

Yuya Nishihara - Jan. 4, 2018, 8:36 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1508679496 -32400
#      Sun Oct 22 22:38:16 2017 +0900
# Node ID 731765e1876ba38dae45b53a5aed2c204f8c03d5
# Parent  dfe3c291d4011a5e15277f7fdb234a71c504a1a1
log: remove redundant handling of --limit

A returned 'revs' set is pre-filtered by cmdutil.getlogrevs(). The result
of displayer.flush() isn't used anymore, so removed.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1585,8 +1585,6 @@  class changeset_printer(object):
         if rev in self.hunk:
             self.ui.write(self.hunk[rev])
             del self.hunk[rev]
-            return 1
-        return 0
 
     def close(self):
         if self.footer:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3424,9 +3424,6 @@  def log(ui, repo, *pats, **opts):
         elif filematcher is None:
             filematcher = lrfilematcher
 
-    limit = cmdutil.loglimit(opts)
-    count = 0
-
     getrenamed = None
     if opts.get('copies'):
         endrev = None
@@ -3437,8 +3434,6 @@  def log(ui, repo, *pats, **opts):
     ui.pager('log')
     displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
     for rev in revs:
-        if count == limit:
-            break
         ctx = repo[rev]
         copies = None
         if getrenamed is not None and rev:
@@ -3457,8 +3452,7 @@  def log(ui, repo, *pats, **opts):
             revhunksfilter = None
         displayer.show(ctx, copies=copies, matchfn=revmatchfn,
                        hunksfilterfn=revhunksfilter)
-        if displayer.flush(ctx):
-            count += 1
+        displayer.flush(ctx)
 
     displayer.close()