2

我试过搜索,但我找不到从命令行运行 p4v diffdialog 的参数。

以下作品:

% p4v.exe -cmd "diffdialog //depot/filepath/file#13"

但我希望能够区分文件的两个版本。

例如,我希望能够区分同一文件的版本 10 和版本 13。

我尝试了不同的组合,例如:

% p4v.exe -cmd "diffdialog //depot/filepath/file#10 //depot/filepath/file#13"

和其他变体,但看起来它正在尝试将整行解析为要打开的文件的参数。

所以我在想也许我必须使用标志或其他东西来指定源/目标文件和版本,但我找不到这方面的文档。

4

3 回答 3

2

I recently ran into the same problem (wanting to diff 2 files, but I always wanted to diff my workspace revision against some revision in the past).

The big challenge was that the only way to be able to specify what files I wanted was by using p4 or p4v commands. The p4v commands would not accept 2 arguments for the diff operations, and even when you did specify a revision, it would only diff that revision against the next revision, not the current one.

p4 diff would diff the revision specified against my workspace version, but the problem was that the output was only text based.

While reading the documentation (http://www.perforce.com/perforce/doc.current/manuals/cmdref/diff.html#1040665) I came across this line:

By default, the diff routine used is the one built into the p4 command-line application. To change this diff routine to an external diff program, set the P4DIFF environment variable to point to the new program.

(for more info see http://www.perforce.com/perforce/doc.current/manuals/cmdref/env.P4DIFF.html#1040647)

So on a hunch I decided to point that environment variable to my WinMerge directory. Surprisingly enough, it worked! Then I thought, can I point this to the p4merge client, and that works as well. The only (very livable) limitation, is that the previous version shows up as a temp file instead of .

于 2013-09-25T15:28:51.177 回答
0

我刚刚在我签出的文件上运行了这个,它弹出了 diff gui 窗口:

p4v -cmd 'diff //main/dev/myfile.py'

几个caviats:

  1. 您必须已经登录到 P4(p4 login 命令会执行此操作)
  2. 您应该禁用“打开连接”对话框在启动时显示,或者它首先弹出。
于 2013-08-15T00:13:37.250 回答
0

该命令不允许您指定两个文件:

http://answers.perforce.com/articles/KB_Article/Invoking-P4V-from-the-command-line

但是,您可以编写此操作的脚本。您可以调用p4 print以获取要比较的两个文件,然后使用 p4merge 对它们进行比较。

于 2013-05-01T14:07:08.070 回答