Pregunta

I've tried searching, but I cannot find the parameters for running the p4v diffdialog from the command line.

The following works:

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

But I want to be able to to diff two versions of the file.

For example, I want to be able to diff version 10 and version 13 of the same file.

I've tried different combinations like:

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

and other variations, but it looks like it's trying to parse the whole line as the argument for the file to open.

So I'm thinking maybe I have to use flags or something else to specify a source/destination file and versions, but I cannot find documentation on this.

¿Fue útil?

Solución 2

That command doesn't let you specify two files:

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

You could script this operation however. You can invoke p4 print to obtain the two files you want to compare, and then diff them using p4merge.

Otros consejos

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 .

I just ran this on a file I have checked out, and it popped up the diff gui window:

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

A couple of caviats:

  1. You must already be logged in to P4 (p4 login command will do it)
  2. You should disable the "Open Connection" dialog box from showing at startup, or it pops up first.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top