[PATCH 2 of 2 pager-tweaks] dispatch: consolidate pager flag handling to a single place

Augie Fackler raf at durin42.com
Sun Feb 19 20:19:42 EST 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1487553371 18000
#      Sun Feb 19 20:16:11 2017 -0500
# Node ID 86a8d5ba8a05485fa1f90927c41ead4e7bb84b54
# Parent  147cbbe59b257eac92c779361894ae361a788f83
dispatch: consolidate pager flag handling to a single place

This makes a little more sense, thanks to Martin for suggesting it.

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -749,7 +749,10 @@ def _dispatch(req):
             for ui_ in uis:
                 ui_.setconfig('ui', 'interactive', 'off', '-y')
 
-        if options['pager'] != 'auto' and not util.parsebool(options['pager']):
+        pagerbool = util.parsebool(options['pager'])
+        if pagerbool:
+            ui.pager('internal-always-' + cmd)
+        elif options['pager'] != 'auto' and not pagerbool:
             ui.disablepager()
 
         if cmdoptions.get('insecure', False):
@@ -822,8 +825,6 @@ def _dispatch(req):
 
 def _runcommand(ui, options, cmd, cmdfunc):
     """Run a command function, possibly with profiling enabled."""
-    if util.parsebool(options['pager']):
-        ui.pager('internal-always-' + cmd)
     try:
         return cmdfunc()
     except error.SignatureError:


More information about the Mercurial-devel mailing list