[PATCH 13 of 13 V3] pager: do not read from environment variable

Jun Wu quark at fb.com
Wed Mar 22 13:23:45 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1489456112 25200
#      Mon Mar 13 18:48:32 2017 -0700
# Node ID 0c20ac74b2405ab01d253e884bf64c9128307047
# Parent  cc9d6ca646db2ee51920abdfd2f235b55e0f28d4
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 0c20ac74b240
pager: do not read from environment variable

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
@@ -847,12 +847,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