This is an archive of the discontinued Mercurial Phabricator instance.

extdiff: allow pager to be used
AbandonedPublic

Authored by quark on Sep 22 2017, 7:13 PM.

Details

Reviewers
yuja
Group Reviewers
hg-reviewers
Summary

Now the pager extension is deprecated, there is no easy way to enable pager
for extdiff. This patch makes it possible to enable pager for individual
extdiff commands by setting pager.attend-x. We don't enable pager by
default because it could have unwanted side-effects if the external pager is
a GUI or ncurses program.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

quark created this revision.Sep 22 2017, 7:13 PM

Before I accept this, I think we should have a brief conversation on the possibility that an external diff tool invokes its own pager.

Do we need a per-diff tool config option to control whether hg invokes a pager? I think hg using a pager by default makes sense. But I also suspect there will be an external diff tool that doesn't like this behavior.

yuja requested changes to this revision.Sep 25 2017, 8:47 AM
yuja added a subscriber: yuja.

Pager should be disabled at least for GUI tools. Otherwise hg gui-diff & would
be suspended by signal. Perhaps curses-based tools would have a similar problem.

This revision now requires changes to proceed.Sep 25 2017, 8:47 AM
quark edited the summary of this revision. (Show Details)Sep 25 2017, 6:34 PM
quark retitled this revision from extdiff: use pager to extdiff: allow pager to be used.
quark updated this revision to Diff 2070.
quark updated this revision to Diff 2071.Sep 25 2017, 6:37 PM
yuja requested changes to this revision.Sep 29 2017, 2:42 AM

It seems confusing to support the global pager.attend-* option only in extdiff context.
Instead, maybe we can use the .gui flag of merge-tools (plus another boolean for
vimdiff-like tools.)

Alternatively, we could resurrect the global pager.attend-* support, but perhaps there
would be a reason not to?

This revision now requires changes to proceed.Sep 29 2017, 2:42 AM
quark added a comment.EditedSep 29 2017, 5:46 PM
In D803#14125, @yuja wrote:

It seems confusing to support the global pager.attend-* option only in extdiff context.
Instead, maybe we can use the .gui flag of merge-tools (plus another boolean for
vimdiff-like tools.)

The option is still there.

The difference between core commands and extdiff commands here is core commands have
pager.attend-* set to True by default. But extdiff commands have attend-* set to
False to not cause surprises.

To be consistent, we can enable pager by default and allow it to be disabled via
attend-* configs, just like core hg commands. Since we have already BC on "log"
(default changed from not using pager to use pager), I think it's okay to BC here.
That looks cleaner than adding more config flags?

Alternatively, we could resurrect the global pager.attend-* support, but perhaps there
would be a reason not to?

One reason for not doing command-level pager is a "command" is conceptually bigger than
"page content". ex. users may want pager for shelve -l / bookmark, but not shelve /
bookmark foo.

yuja added a comment.Sep 29 2017, 6:29 PM

The difference between core commands and extdiff commands here is core commands have
pager.attend-* set to True by default. But extdiff commands have attend-* set to
False to not cause surprises.

That's only true for page-able commands. You can't get pager for e.g. hg version by
setting pager.attend-version=True unless you have the pager extension enabled.
So the pager.attend-* option seems tricky as it is right now. That's probably why it
isn't documented, and we suggest using pager.ignore instead.

To be consistent, we can enable pager by default and allow it to be disabled via
attend-* configs, just like core hg commands. Since we have already BC on "log"
(default changed from not using pager to use pager), I think it's okay to BC here.
That looks cleaner than adding more config flags?

Given GUI diff is one of the main use case of extdiff, it's probably unacceptable to
introduce BC of breaking it.

quark abandoned this revision.EditedOct 9 2017, 9:21 PM

I'm not sure if it's worth adding more config options. Maybe just make it the user's responsibility since they can always pipe the output to a pager, or use --pager=on.

Given the fact that there are easy alternative solutions. I'm abandoning this patch.