[PATCH] Log, annotate and diff use an environment pager if available

David Soria Parra sn_ at gmx.net
Sat Mar 8 18:08:17 CST 2008

Bryan O'Sullivan wrote:
> David Soria Parra wrote:
>> +  usepager;;
>> +    If set to false, the pager is not used. True or False. Default is True.
> This is a backwards incompatible change, and is not OK.

Yes it makes more sense to disable it by default.

>> -                self.ui.write(h)
>> +                self.pager.write(h)
> Whether or not a pager is being used should be hidden in the ui code.
> It's bad layering to have it infect other sites at random.
The chosed the way i implemented it, to make it possible for every command to decide
to use a pager at all which makes sense in some kinds. E.g. maybe we decide that
the help command should not use a pager at all

>> +
> Don't add extra blank lines to code you're not changing.
>> +    The pager is not used if the output is not longer than min_lines
>> +    but instead prints the output to stdout.
> The pager already contains logic to handle this kind of case, so there's
> absolutely no reason to buffer output.
it's not kind of buffering like the pager does. The buffering is only enabled, because
if we don't reach a certain limit of lines to be outputted, we use stdout.

This is because e.g. a "hg help version" will output just a few lines, it's not very user friendly
to call a pager then for an output that usually fits into the terminal that is used. Therefore i
choose a limit of 25 lines before using the pager. Thats whas really get buffered. When the first 25
lines are reached and the pager is fired up, nothing else is buffered

More information about the Mercurial-devel mailing list