diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -828,6 +828,7 @@ def _dispatch(req): 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() diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -945,8 +945,14 @@ class ui(object): 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, diff --git a/tests/test-pager.t b/tests/test-pager.t --- a/tests/test-pager.t +++ b/tests/test-pager.t @@ -80,6 +80,34 @@ We can control the pager from the config paged! 'summary: modify a 10\n' paged! '\n' +explicit --pager=on should take precedence over other configurations +(issue5580) + + $ cat >> $HGRCPATH < [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 < [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