Patchwork [3,of,4] annotate: start pager soon after command options are validated

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 24, 2018, 12:34 p.m.
Message ID <3ba66c3809b43da8216a.1543062857@mimosa>
Download mbox | patch
Permalink /patch/36764/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 24, 2018, 12:34 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1543052504 -32400
#      Sat Nov 24 18:41:44 2018 +0900
# Node ID 3ba66c3809b43da8216aea05b0cef15bf3a53109
# Parent  b37d6fbea8df01bd7ea822435f4bfce2a97112e7
annotate: start pager soon after command options are validated

It helps extracting helper class.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -333,6 +333,7 @@  def annotate(ui, repo, *pats, **opts):
         repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
     ctx = scmutil.revsingle(repo, rev)
 
+    ui.pager('annotate')
     rootfm = ui.formatter('annotate', opts)
     if ui.debugflag:
         shorthex = pycompat.identity
@@ -381,8 +382,6 @@  def annotate(ui, repo, *pats, **opts):
         'lineno': 'line_number',
     }
 
-    ui.pager('annotate')
-
     if rootfm.isplain():
         def makefunc(get, fmt):
             return lambda x: fmt(get(x))