ui: enable pager always for explicit --pager=on (
issue5580)
Before this patch, explicit --pager=on is unintentionally ignored by
any disabling factor, even if priority of it is less than --pager=on
(e.g. "[ui] paginate = off").
--- a/mercurial/dispatch.py Mon Jul 31 21:47:53 2017 +0900
+++ b/mercurial/dispatch.py Tue Aug 01 18:52:52 2017 +0900
@@ -828,6 +828,7 @@
color.setup(ui_)
if util.parsebool(options['pager']):
+ # ui.pager() expects 'internal-always-' prefix in this case
ui.pager('internal-always-' + cmd)
elif options['pager'] != 'auto':
ui.disablepager()
--- a/mercurial/ui.py Mon Jul 31 21:47:53 2017 +0900
+++ b/mercurial/ui.py Tue Aug 01 18:52:52 2017 +0900
@@ -945,8 +945,14 @@
not "history, "summary" not "summ", etc.
"""
if (self._disablepager
- or self.pageractive
- or command in self.configlist('pager', 'ignore')
+ or self.pageractive):
+ # how pager should do is already determined
+ return
+
+ if not command.startswith('internal-always-') and (
+ # explicit --pager=on (= 'internal-always-' prefix) should
+ # take precedence over disabling factors below
+ command in self.configlist('pager', 'ignore')
or not self.configbool('ui', 'paginate')
or not self.configbool('pager', 'attend-' + command, True)
# TODO: if we want to allow HGPLAINEXCEPT=pager,
--- a/tests/test-pager.t Mon Jul 31 21:47:53 2017 +0900
+++ b/tests/test-pager.t Tue Aug 01 18:52:52 2017 +0900
@@ -80,6 +80,34 @@
paged! 'summary: modify a 10\n'
paged! '\n'
+explicit --pager=on should take precedence over other configurations
+(issue5580)
+
+ $ cat >> $HGRCPATH <<EOF
+ > [ui]
+ > paginate = false
+ > EOF
+ $ hg log --limit 1 --pager=on
+ paged! 'changeset: 10:46106edeeb38\n'
+ paged! 'tag: tip\n'
+ paged! 'user: test\n'
+ paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
+ paged! 'summary: modify a 10\n'
+ paged! '\n'
+
+ $ cat >> $HGRCPATH <<EOF
+ > [ui]
+ > # true is default value of ui.paginate
+ > paginate = true
+ > EOF
+ $ hg log --limit 1 --pager=off
+ changeset: 10:46106edeeb38
+ tag: tip
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: modify a 10
+
+
We can enable the pager on id:
BROKEN: should be paged