Skip to content

Draft: extdiff: use pager, including color support options

Steve requested to merge topic/default/pagedcmdopts into branch/default

I wanted to try out difftastic as an external diff command for mercurial. It works, but it doesn't run the output through the pager. And if I use --pager=yes to force it, then I lose color. difft has a --color=auto option, but if it is piping to a pager then its auto option will suppress color. And if I use --color=always, then I run into problems when piping the output to a file or through grep or whatever.

My solutions here may be controversial. First, I send the extdiff program's output through a pager by default. This might break some programs, especially GUIs. Perhaps it would be better to either default to not paginating but allow turning it on. Or perhaps basing the default on isgui.

Second, I achieved both pagination and coloring by allowing additional command line options to be specified that are only used if the pager is being used. This allows

[extdiff]
mydiff = difft
mydiff.pagecmdopts = --color=always

Merge request reports