diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -869,7 +869,6 @@ class ui(object): # interactive, the user didn't say HGPLAIN or # HGPLAINEXCEPT=pager, and the user didn't specify --debug. return - self.debug('starting pager for command %r\n' % command) # TODO: add a "system defaults" config section so this default # of more(1) can be easily replaced with a global @@ -879,6 +878,10 @@ class ui(object): # default editor command similar treatment. envpager = encoding.environ.get('PAGER', 'more') pagercmd = self.config('pager', 'pager', envpager) + if not pagercmd: + return + + self.debug('starting pager for command %r\n' % command) self.pageractive = True # Preserve the formatted-ness of the UI. This is important # because we mess with stdout, which might confuse diff --git a/tests/test-pager.t b/tests/test-pager.t --- a/tests/test-pager.t +++ b/tests/test-pager.t @@ -89,6 +89,12 @@ Pager should not start if stdout is not $ hg log -l1 -q --config ui.formatted=False 10:46106edeeb38 +Pager should be disabled if pager.pager is empty (otherwise the output would +be silently lost.) + + $ hg log -l1 -q --config pager.pager= + 10:46106edeeb38 + Pager with color enabled allows colors to come through by default, even though stdout is no longer a tty. $ cat >> $HGRCPATH <