我在~/.hgrc
...
[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]
允许动态终端宽度用于并排差异?
答案 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错误。