changeset 19940:7d99bff0f77c stable

pager: honour internal aliases If paging is configured for a command all it's internal defined aliases will be paged as well. This will make attend=log cause 'hg history' to run the pager. However custom aliases will not be paged by default.
author David Soria Parra <dsp@experimentalworks.net>
date Sat, 12 Oct 2013 18:51:34 -0700
parents b7cc56bc0b15
children 2bf99bc5077a
files hgext/pager.py
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/pager.py	Sun Oct 20 16:45:04 2013 -0700
+++ b/hgext/pager.py	Sat Oct 12 18:51:34 2013 -0700
@@ -48,7 +48,7 @@
 '''
 
 import atexit, sys, os, signal, subprocess, errno, shlex
-from mercurial import commands, dispatch, util, extensions
+from mercurial import commands, dispatch, util, extensions, cmdutil
 from mercurial.i18n import _
 
 testedwith = 'internal'
@@ -121,14 +121,20 @@
             attend = ui.configlist('pager', 'attend', attended)
             auto = options['pager'] == 'auto'
             always = util.parsebool(options['pager'])
-            if (always or auto and
-                (cmd in attend or
-                 (cmd not in ui.configlist('pager', 'ignore') and not attend))):
-                ui.setconfig('ui', 'formatted', ui.formatted())
-                ui.setconfig('ui', 'interactive', False)
-                if util.safehasattr(signal, "SIGPIPE"):
-                    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-                _runpager(ui, p)
+
+            cmds, _ = cmdutil.findcmd(cmd, commands.table)
+
+            ignore = ui.configlist('pager', 'ignore')
+            for cmd in cmds:
+                if (always or auto and
+                    (cmd in attend or
+                     (cmd not in ignore and not attend))):
+                    ui.setconfig('ui', 'formatted', ui.formatted())
+                    ui.setconfig('ui', 'interactive', False)
+                    if util.safehasattr(signal, "SIGPIPE"):
+                        signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+                    _runpager(ui, p)
+                    break
         return orig(ui, options, cmd, cmdfunc)
 
     extensions.wrapfunction(dispatch, '_runcommand', pagecmd)