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.
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
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.
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.
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?
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.
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.
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.