When I run commands such as hg log
, I expect to see the output in a pager. I have configured my repository .hg\hgrc
to use less
:
...
[pager]
pager = C:\path\to\bin\less.exe
...
I have confirmed that less
is correctly installed, as I am able to run it.
I have also confirmed with hg config --debug
that this environment setting is correctly registered:
...
C:\path\to\repo/.hg/hgrc:23: pager.pager=C:\path\to\bin\less.exe
...
However, the output is instead dumped into terminal. This is a major nuisance, especially with hg log
since the project I am working on has history dating back to 2001. Removing the configuration settings does not cause output to go through more
, which according to Mercurial documentation should be the default Windows pager. (and yes, I have checked that more
is installed)
If no pager is set in the user or repository configuration, Mercurial uses the environment variable $PAGER. If $PAGER is not set, pager.pager from the default or system configuration is used. If none of these are set, a default pager will be used, typically 'less' on Unix and 'more' on Windows.
Is it a known issue that Mercurial pager support on Windows is currently broken? If not, what steps can I take to make Mercurial recognize and use a pager? At this point I don't even care if it uses less
as long as the output is sent to any pager.
Environment: Mercurial version 6.3.2 (installed with TortoiseHG) on Windows 11.
I have attempted to run hg commands through Command Prompt, Powershell, and Git Bash; none of them correctly use the pager configuration (or any other pager, e.g. more
).
EDIT: in response to a comment below, here is the full output of hg --version --verbose
:
Mercurial Distributed SCM (version 6.3.2)
(see https://mercurial-scm.org for more information)
Copyright (C) 2005-2023 Olivia Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Enabled extensions:
This question does not resolve my issue as it uses the PagerExtension, which is outdated and unnecessary as of current Mercurial version. I have also tried the steps here to use the PagerExtension, to no avail.
TortoiseHG is slightly different than pure Mercurial in Windows, not due to code-changes, but (as it was discovered during last researches) due to py2exe limitations.
Pager support is one of such things: if you'll run hg version --debug
you'll see warning about it
> hg version --debug
pager is unavailable with py2exe packaging
Mercurial Distributed SCM (version 6.3.2)
(see https://mercurial-scm.org for more information)
...
Workarounds
hg log | bat -p -l log --pager "moar --no-linenumbers"
with best viewer and pager at a time and even still don't overload hg log
in shell alias (use PowerShell history and expansion)