2

I'm trying to set the pager used for Mercurial but the output is empty, even if I specify the command in the [pager] section or as the PAGER environment variable.

I noticed that the command provided is launched with cmd.exe. Is this the cause of empty output, and if yes, what is the right syntax?

Environment: Mercurial 1.5, Mercurial 1.4.3

hgrc:

[extensions]
pager =

[pager]
pager = d:\tools\less\less.exe

Sample command lines (from Process Explorer):

hg diff
c:\windows\system32\cmd.exe /c "d:\tools\less\less.exe 2> NUL:"
d:\tools\less\less.exe

UPDATE

In pager.py, by replacing:

sys.stderr = sys.stdout = util.popen(p, "wb")

with

sys.stderr = sys.stdout = subprocess.Popen(p, stdin = subprocess.PIPE, shell=False).stdin

I managed to obtain the desired output for the hg status and diff.

BUT, I'm sure it's wrong (or at least incomplete), and I have no control over the pager app (less.exe): the output is shown in the cmd.exe window, I can see the less prompt (:) but any further input is fed into cmd.exe. It seems that the pager app is still active in the background: after typing exit in the cmd.exe window, I have control over the pager app, and I can terminate it normally.

Also, it makes no difference what I'm choosing as a pager app (more is behaving the same).

UPDATE 2

Issue1677 - [PATCH] pager for "hg help" output on windows

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
alexandrul
  • 12,856
  • 13
  • 72
  • 99

2 Answers2

0

Did you enable the pager extension in your ~/.hgrc or mercurial.ini file?

  [extensions]
  pager =

It's came with your mercurial installation, but you still need to enable it.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
0

I have modified the pager extension to use a temporary file for storing the commands output, the resulting extension can be found on CodePlex and Bitbucket.

alexandrul
  • 12,856
  • 13
  • 72
  • 99