[PATCH 11 of 11 V2] pager: do not read from environment variable

Ryan McElroy rm at fb.com
Wed Mar 22 07:39:40 EDT 2017


On 3/22/17 7:51 AM, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1489456112 25200
> #      Mon Mar 13 18:48:32 2017 -0700
> # Node ID d2b34be3b64a6ca60644576b806e5b7172d524cc
> # Parent  713d562d0a2426c8658675a66158e6c412ae9dcc
> pager: do not read from environment variable

Overall, I'm a big +1 on this series. It's a good bug fix and a great 
clean up. I think it can be even better with the suggestions I made, but 
feel free to push back if you think I missed something about your 
approach that's better than what I suggested.

>
> We have converted $PAGER to config, ui.pager() now can just read the config,
> without looking at environment variables.
>
> diff --git a/mercurial/ui.py b/mercurial/ui.py
> --- a/mercurial/ui.py
> +++ b/mercurial/ui.py
> @@ -846,12 +846,6 @@ class ui(object):
>               return
>   
> -        # TODO: add a "system defaults" config section so this default
> -        # of more(1) can be easily replaced with a global
> -        # configuration file. For example, on OS X the sane default is
> -        # less(1), not more(1), and on debian it's
> -        # sensible-pager(1). We should probably also give the system
> -        # default editor command similar treatment.
> -        envpager = encoding.environ.get('PAGER', 'more')
> -        pagercmd = self.config('pager', 'pager', envpager)
> +        fallbackpager = 'more'
> +        pagercmd = self.config('pager', 'pager', fallbackpager)
>           if not pagercmd:
>               return
>



More information about the Mercurial-devel mailing list