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

Augie Fackler raf at durin42.com
Sun Feb 19 23:12:08 UTC 2017


# HG changeset patch
# User Augie Fackler <augie at 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.

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


More information about the Mercurial-devel mailing list