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