How do I get diffs of all the files in a pending Perforce changelist?

Viewed 37266

I want to get diffs on files in a specific pending changelist. I wish I could do this:

p4 diff -c 999

Can someone help me string together some csh magic to make this happen?

Maybe take the output of p4 opened -c 999 and piping it to p4 diff?

9 Answers

The easiest way is in p4v or p4win, but that's not what you were asking about.

Try this:

p4 opened -c 999 | awk 'BEGIN { FS = "#" } // { print "p4 diff " $1 }' | csh

You, of course, need to make sure that the sub shell has p4 in its path, and $P4CLIENT, etc... are all set up.

For a one-liner that works from the Windows cmd shell, try this:

for /f "usebackq delims=#" %F in (`p4 opened -c 999`) do @p4 diff %F

To do this in a batch file you need to use %%F instead of just %F.

Note that some of the solution above will work under Windows if you have installed a unix-like utilities package such as cygwin or unixutils, but this one-liner has no external dependencies.

For Unshelved Changes( Changes still not in depot)

p4 opened -c 999 | awk 'BEGIN { FS = "#" } // { print "p4 diff " $1 }' | bash

For Shelved Changes( Changes that in depot ( p4 shelve -c 999)

p4 describe -S -du3 -O 999
Related