Mercurial > public > mercurial-scm > hg-stable
diff hgext/pager.py @ 31013:9c2977ceaa46
pager: move more behavior into core
This moves the global flag and the --pager=yes logic into core. Only
functionality change is that users now always get a --pager flag and
can enable the pager via the flag without the extension active.
Moving the flag into core exposes a defect in the ro localization,
which will have to be corrected later.
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 15 Feb 2017 17:47:57 -0500 |
parents | 61b4122019d3 |
children | 5e85bab867a7 |
line wrap: on
line diff
--- a/hgext/pager.py Wed Feb 15 17:47:51 2017 -0500 +++ b/hgext/pager.py Wed Feb 15 17:47:57 2017 -0500 @@ -60,13 +60,11 @@ ''' from __future__ import absolute_import -from mercurial.i18n import _ from mercurial import ( cmdutil, commands, dispatch, extensions, - util, ) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for @@ -78,15 +76,9 @@ def uisetup(ui): def pagecmd(orig, ui, options, cmd, cmdfunc): - usepager = False - always = util.parsebool(options['pager']) auto = options['pager'] == 'auto' - - if always: - usepager = True - elif not auto: + if auto and not ui.pageractive: usepager = False - else: attend = ui.configlist('pager', 'attend', attended) ignore = ui.configlist('pager', 'ignore') cmds, _ = cmdutil.findcmd(cmd, commands.table) @@ -101,8 +93,8 @@ usepager = True break - if usepager: - ui.pager('extension-via-attend-' + cmd) + if usepager: + ui.pager('extension-via-attend-' + cmd) return orig(ui, options, cmd, cmdfunc) # Wrap dispatch._runcommand after color is loaded so color can see @@ -112,10 +104,4 @@ extensions.wrapfunction(dispatch, '_runcommand', pagecmd) extensions.afterloaded('color', afterloaded) -def extsetup(ui): - commands.globalopts.append( - ('', 'pager', 'auto', - _("when to paginate (boolean, always, auto, or never)"), - _('TYPE'))) - attended = ['annotate', 'cat', 'diff', 'export', 'glog', 'log', 'qdiff']