Patchwork [pager,annotate-fix] annotate: start pager after we're sure we wont abort

login
register
mail settings
Submitter Augie Fackler
Date Feb. 19, 2017, 11:12 p.m.
Message ID <7353b9603c574678314f.1487545928@imladris.local>
Download mbox | patch
Permalink /patch/18655/
State Accepted
Headers show

Comments

Augie Fackler - Feb. 19, 2017, 11:12 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1487534981 18000
#      Sun Feb 19 15:09:41 2017 -0500
# Node ID 7353b9603c574678314f9525b3e56f31a4497bb9
# Parent  2c9e619ba9ee8e72370cc0f27f59da39947773b6
annotate: start pager after we're sure we wont abort

This avoids needlessly putting a short error message into the pager.
Yuya Nishihara - Feb. 21, 2017, 12:47 p.m.
On Sun, 19 Feb 2017 18:12:08 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1487534981 18000
> #      Sun Feb 19 15:09:41 2017 -0500
> # Node ID 7353b9603c574678314f9525b3e56f31a4497bb9
> # Parent  2c9e619ba9ee8e72370cc0f27f59da39947773b6
> annotate: start pager after we're sure we wont abort

Queued this, thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -361,7 +361,6 @@  def annotate(ui, repo, *pats, **opts):
 
     Returns 0 on success.
     """
-    ui.pager('annotate')
     if not pats:
         raise error.Abort(_('at least one filename or pattern is required'))
 
@@ -422,6 +421,8 @@  def annotate(ui, repo, *pats, **opts):
     if linenumber and (not opts.get('changeset')) and (not opts.get('number')):
         raise error.Abort(_('at least one of -n/-c is required for -l'))
 
+    ui.pager('annotate')
+
     if fm.isplain():
         def makefunc(get, fmt):
             return lambda x: fmt(get(x))