[PATCH 2 of 2] pager: skip running the pager if it's set to 'cat'

Jun Wu quark at fb.com
Thu Mar 16 00:12:52 EDT 2017


I think these changes are good. I'd like to have more "modernize" stuffs.

Another thing that git does (reasonably, I think) is to set default
environment variable. Say if we decide to go with shell=False, set LESS=FRX
so people using pager.pager=less will have a better experience.

Excerpts from Augie Fackler's message of 2017-03-15 21:44:26 -0400:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1489624466 14400
> #      Wed Mar 15 20:34:26 2017 -0400
> # Node ID bc0c38ec3f7be807607d4fdf871f344e7079d992
> # Parent  07d488f16da6e12b225d2827f1020f32c8050a7a
> pager: skip running the pager if it's set to 'cat'
> 
> Avoid useless uses of cat.
> 
> diff --git a/mercurial/ui.py b/mercurial/ui.py
> --- a/mercurial/ui.py
> +++ b/mercurial/ui.py
> @@ -935,6 +935,9 @@ class ui(object):
>          This is separate in part so that extensions (like chg) can
>          override how a pager is invoked.
>          """
> +        if command == 'cat':
> +            # Save ourselves some work.
> +            return
>          # If the command doesn't contain any of these characters, we
>          # assume it's a binary and exec it directly. This means for
>          # simple pager command configurations, we can degrade


More information about the Mercurial-devel mailing list