开发者

Perforce visual diff of a branched file (p4 diff2 with external diff)

开发者 https://www.devze.com 2022-12-19 02:52 出处:网络
I\'d like see a visual diff of a branched file. So I do this开发者_C百科 p4 diff2 -b branchname main.cpp

I'd like see a visual diff of a branched file. So I do this开发者_C百科

p4 diff2 -b branchname main.cpp

One problem... it's not visual and external diff isn't supported. http://www.perforce.com/perforce/doc.current/manuals/cmdref/diff2.html

p4 diff2 does not use the diff program specified by the environment variable P4DIFF.
The diff algorithm used by p4 diff2 runs on the machine hosting the Perforce server,
and always uses the server's built-in diff routine.

I want my visual diff. How do I get it?


Maybe easiest to do the diff from P4V?

Other than that, you might have to p4 print the two files to some local temporaries, and then run the diff on those?


You should give Kdiff3 a try if you're not using it already.

For your scenario, I'd do this (from old-school P4Win):

  • go to the first file -> right click -> explore. This opens up the file in explorer. Right-click it -> Kdiff3 -> Save [file name] for later
  • go to the second file -> right click -> explore -> right-click file -> Kdiff3 -> Compare With -> [first file]

Ta-da!

I am assuming your local repository contains both files. I'm also assuming you're running Windows, but this could be adapted to other OS-es, as Kdiff3 is multi-platform.


You may be able to pull this off. The Perforce blog has an entry on calling p4v tasks from the command line.
I could only get the diffdialog command to work on a single file, but maybe if you play around with it you could figure out something.


Use p4 diff.

from http://www.perforce.com/perforce/doc.021/manuals/cmdref/diff2.html:
"p4 diff2 does not use the diff program specified by the environment variable P4DIFF. The diff algorithm used by p4 diff2 runs on the machine hosting the Perforce server, and always uses the server's built-in diff routine."

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号