我在我的~/.hgrc中使用extdiff

[extensions]
pager =
hgext.extdiff =

[extdiff]
# add new command that runs GNU diff(1) in 'side-by-side' mode
cmd.sdiff = sh
opts.sdiff = -c 'diff -dbB --left-column -y -W `tput cols` $0 $1'

[pager]
pager = LESS='FRX' less
attend = cat, diff, sdiff, glog, log, incoming, outgoing, lg, show, lga

这意味着我可以对自述文件使用hg sdiff READMEside-by-side mode中的diff;但是,由于某种原因,当我运行shell时,上面的tput cols输出仍然提供了80个字符。
如果我从hg sdiff扩展删除sdiff,则我的[pager]将跨越整个终端宽度…
[pager]
pager = LESS='FRX' less
## Removing sdiff fixes the problem with terminal width
attend = cat, diff, glog, log, incoming, outgoing, lg, show, lga

即使我从sdiff部分移除sdiff并手动通过[pager]作为less管道,diff仍然跨越整个终端宽度。如何获得hg sdiff | less -FRX[extdiff]以允许动态端子宽度用于并排差异?

最佳答案

我找到的唯一解决办法是

[extdiff]
# add new command that runs GNU diff(1) in 'side-by-side' mode
cmd.sdiff = sh
opts.sdiff = -c 'diff -dbB --left-column -y -W `tput cols` $0 $1 | less -FRX'

我还从sdiff部分删除[pager]。这看起来像是一个变幻莫测的虫子。

10-04 13:39