问题描述
在这个网站上得到了很好的回答,Bram Cohen的耐心差异在bazaar中被作为默认差异和git diff选项发现,但是我发现很难找到一个独立的独立程序来实现这个特定的差异算法。
例如,我想将耐心差异应用于perforce差异,并且使用典型的frobnitz代码示例显示了耐心差异如何更好:
右侧的终端使用 - 耐心
标志调用了 git diff
。
我还设置了 diff-highlight
perl脚本,在这些线条的第一个和最后一个不同部分之间形成一条线。左侧有一个例子,这并没有太大的帮助,但我会让它滑动,因为至少有是那里有分号......无论如何,对diff-highlight脚本进行改进是不是这个问题的主题。
除了在哪里可以找到独立的耐心差异,如果有人知道如何让perforce p4
使用外部差异程序,这也是必须完成的事情。
这可能不像我想要的那么理想,但从实践的角度来看,解决方案是非常好的一个该死的好观点)。
git diff --no-index --patience file1 file2
完成这项工作。 (谢谢@StevenPenny)
$ b $ p $ P4DIFF
变量定义外部差异...我们只是 git diff --patience --no-index
到那个。
It is well-answered on this site that Bram Cohen's patience diff is found in bazaar as the default diff and as an option with git diff, but I am finding it difficult to source an independent standalone program that implements this particular diff algorithm.
For example I'd like to apply patience diff to perforce diffs, and it's pretty clear with the canonical "frobnitz" code example how patience diff is better:
The terminal on the right has invoked the git diff
with the --patience
flag.
I also have set up the diff-highlight
perl script, whose job it is to invert colors on matched-up lines between the first and last different sections of those lines. The left side has an example where this doesn't quite help so much but I'll let it slide because at least there is that semicolon there... Anyway, making improvements to the diff-highlight script is not the subject of this question.
In addition to the question of where to find a standalone patience diff, if anybody knows how to make perforce p4
use an external diff program, that's also something that has to be done.
It's perhaps not as ideal as I'd like it, but the solution is perfectly good from a practical perspective (and thats a damn good perspective to have).
git diff --no-index --patience file1 file2
does the job. (thanks @StevenPenny)
$P4DIFF
variable defines the external diff... we just stuff git diff --patience --no-index
into that.
这篇关于我在哪里可以找到耐心差异实施?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!