[PATCH 1 of 3 STABLE V2] pager: rename 'pager.enable' to 'ui.pager'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon May 1 16:29:21 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1493649410 -7200
#      Mon May 01 16:36:50 2017 +0200
# Branch stable
# Node ID 853bf9ca7b3b1f4d8f54ed8c60ff92371132c097
# Parent  ad70a36b5b472c295bfdb849ba69eac871305b36
# EXP-Topic pager
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 853bf9ca7b3b
pager: rename 'pager.enable' to 'ui.pager'

This aligns with what we do for color (see 7fec37746417). Pager is a central
enough notion that having the master config in the [ui] section makes senses. It
will helps with consistency, discoverability. It will also help having a simple
and clear example hgrc mentioning pager.

The previous form of the option had never been released in a non-rc version but
we keep it around for convenience. If both are set, 'ui.pager' take priority.

diff --git a/mercurial/help/pager.txt b/mercurial/help/pager.txt
--- a/mercurial/help/pager.txt
+++ b/mercurial/help/pager.txt
@@ -29,7 +29,7 @@ you can use --pager=<value>:
 
 To globally turn off all attempts to use a pager, set::
 
-  [pager]
-  enable = false
+  [ui]
+  pager = false
 
 which will prevent the pager from running.
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -848,7 +848,8 @@ class ui(object):
         if (self._disablepager
             or self.pageractive
             or command in self.configlist('pager', 'ignore')
-            or not self.configbool('pager', 'enable', True)
+            or not self.configbool('ui', 'pager',
+                                   self.configbool('pager', 'enable', True))
             or not self.configbool('pager', 'attend-' + command, True)
             # TODO: if we want to allow HGPLAINEXCEPT=pager,
             # formatted() will need some adjustment.
diff --git a/tests/test-pager.t b/tests/test-pager.t
--- a/tests/test-pager.t
+++ b/tests/test-pager.t
@@ -54,21 +54,21 @@ By default diff and log are paged, but i
 
 We can control the pager from the config
 
-  $ hg log --limit 1 --config 'pager.enable=False'
+  $ hg log --limit 1 --config 'ui.pager=False'
   changeset:   10:46106edeeb38
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     modify a 10
   
-  $ hg log --limit 1 --config 'pager.enable=0'
+  $ hg log --limit 1 --config 'ui.pager=0'
   changeset:   10:46106edeeb38
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     modify a 10
   
-  $ hg log --limit 1 --config 'pager.enable=1'
+  $ hg log --limit 1 --config 'ui.pager=1'
   paged! 'changeset:   10:46106edeeb38\n'
   paged! 'tag:         tip\n'
   paged! 'user:        test\n'


More information about the Mercurial-devel mailing list