[PATCH] pager: add more incoming, outgoing, help to default attend list (issue3442)

Eduard-Cristian Stefan alexandrul.ct at gmail.com
Sat May 12 06:22:30 CDT 2012


On 2012-05-12 12:20, Brodie Rao wrote:
> If I try PAGER=less hg outgoing --pager=yes with an HTTP repo
> requiring authentication, I get an invisible username prompt, and only
> after pressing enter do I see the password prompt. If I use
> PAGER=most, my terminal locks up (probably due to how most buffers
> input).

Hokorobi had a wonderful idea regarding paging on Windows platform:

1. use color in win32 mode, so unpaged commands are colored in the console.
2. inside the pager extension translate the escape codes into the ANSI ones,
so the paged content can be properly shown by the pager app (less.exe)

This is working just fine, but a nicer way would be to select the proper
escape codes based on the destination: ANSI in case the output should be paged
and win32 in every other case.

For that, the color extension should know if the command needs user input
or not. Outgoing is the perfect example, if I have set up the auth data,
I would only get a password prompt if I changed the password,
so it's not safe to assume anything based on the command parameters only.

IMHO a two stage process for sensitive command would be perfect:

1.based on the parameters and interaction with external sources
the command can determine if user interaction is needed and sets
the required flags (supports colored output, can be paged, etc)

2. the second stage would be output only, and this is the one that
should be wrapped by the color and pager extensions. In this setup,
in the color extension if the output flag "can be paged" is set,
and if the pager extension is enabled, then ANSI mode can be used,
otherwise win32 mode should be selected.

Have a nice day,
   Eduard


More information about the Mercurial-devel mailing list