Mercurial并排差异(最大术语宽度)

时间:2015-01-31 19:02:12

标签: linux shell terminal mercurial

我在~/.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 README并在side-by-side mode中使用diff作为自述文件;但是,出于某种原因,当我通过tput cols运行时,上面hg sdiff的输出仍会给shell带来80个字符。

如果我从sdiff扩展程序中移除[pager],则sdiff会覆盖整个终端宽度...

[pager]
pager = LESS='FRX' less
## Removing sdiff fixes the problem with terminal width
attend = cat, diff, glog, log, incoming, outgoing, lg, show, lga

即使我从sdiff部分删除了[pager]并手动将less作为hg sdiff | less -FRX进行管道传输,但差异仍会跨越一个完整的终端宽度。如何让[extdiff][pager]允许动态终端宽度用于并排差异?

1 个答案:

答案 0 :(得分:0)

我找到的唯一解决方法是

[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]。这看起来像是一个Mercurial错误。