Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 31693:c5fe0c7dad94
pager: do not read from environment variable
$PAGER is converted to the pager.pager config item. So it's no longer
necessary to read $PAGER in ui.pager().
author | Jun Wu <quark@fb.com> |
---|---|
date | Sun, 26 Mar 2017 21:43:47 -0700 |
parents | 5bea95a1d353 |
children | 2d11d278279a |
comparison
equal
deleted
inserted
replaced
31692:5bea95a1d353 | 31693:c5fe0c7dad94 |
---|---|
847 # We only want to paginate if the ui appears to be | 847 # We only want to paginate if the ui appears to be |
848 # interactive, the user didn't say HGPLAIN or | 848 # interactive, the user didn't say HGPLAIN or |
849 # HGPLAINEXCEPT=pager, and the user didn't specify --debug. | 849 # HGPLAINEXCEPT=pager, and the user didn't specify --debug. |
850 return | 850 return |
851 | 851 |
852 # TODO: add a "system defaults" config section so this default | 852 fallbackpager = 'more' |
853 # of more(1) can be easily replaced with a global | 853 pagercmd = self.config('pager', 'pager', fallbackpager) |
854 # configuration file. For example, on OS X the sane default is | |
855 # less(1), not more(1), and on debian it's | |
856 # sensible-pager(1). We should probably also give the system | |
857 # default editor command similar treatment. | |
858 envpager = encoding.environ.get('PAGER', 'more') | |
859 pagercmd = self.config('pager', 'pager', envpager) | |
860 if not pagercmd: | 854 if not pagercmd: |
861 return | 855 return |
862 | 856 |
863 self.debug('starting pager for command %r\n' % command) | 857 self.debug('starting pager for command %r\n' % command) |
864 self.flush() | 858 self.flush() |