# HG changeset patch # User Yuya Nishihara # Date 2017-04-28 11:51:14 # Node ID bf5e13e38390809378f2ca9aa42cff4e7bd49741 # Parent de115db3688e304e7ad55dd422c585da315d5383 pager: use less as a fallback on Unix This seems reasonable choice per discussion, and the default-default of Git. See also the inline-comment for why. https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-April/097042.html diff --git a/mercurial/help/pager.txt b/mercurial/help/pager.txt --- a/mercurial/help/pager.txt +++ b/mercurial/help/pager.txt @@ -8,7 +8,7 @@ To set the pager that should be used, se If no pager is set, the pager extensions uses the environment variable $PAGER. If neither pager.pager, nor $PAGER is set, a default pager -will be used, typically `more`. +will be used, typically `less` on Unix and `more` on Windows. You can disable the pager for certain commands by adding them to the pager.ignore list:: diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py --- a/mercurial/rcutil.py +++ b/mercurial/rcutil.py @@ -21,6 +21,7 @@ if pycompat.osname == 'nt': else: from . import scmposix as scmplatform +fallbackpager = scmplatform.fallbackpager systemrcpath = scmplatform.systemrcpath userrcpath = scmplatform.userrcpath diff --git a/mercurial/scmposix.py b/mercurial/scmposix.py --- a/mercurial/scmposix.py +++ b/mercurial/scmposix.py @@ -12,6 +12,12 @@ from . import ( pycompat, ) +# BSD 'more' escapes ANSI color sequences by default. This can be disabled by +# $MORE variable, but there's no compatible option with Linux 'more'. Given +# OS X is widely used and most modern Unix systems would have 'less', setting +# 'less' as the default seems reasonable. +fallbackpager = 'less' + def _rcfiles(path): rcs = [os.path.join(path, 'hgrc')] rcdir = os.path.join(path, 'hgrc.d') diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py --- a/mercurial/scmwindows.py +++ b/mercurial/scmwindows.py @@ -16,6 +16,9 @@ try: except ImportError: import winreg +# MS-DOS 'more' is the only pager available by default on Windows. +fallbackpager = 'more' + def systemrcpath(): '''return default os-specific hgrc search path''' rcpath = [] diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -857,8 +857,7 @@ class ui(object): # HGPLAINEXCEPT=pager, and the user didn't specify --debug. return - fallbackpager = 'more' - pagercmd = self.config('pager', 'pager', fallbackpager) + pagercmd = self.config('pager', 'pager', rcutil.fallbackpager) if not pagercmd: return