views:

1327

answers:

3

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?

+2  A: 
Mark Thalman
great that works! one question though, how can I replace the 999 with a variable to use in an alias. This is as far as I got but my understanding of alias parameters and escaping rules is limited.alias p4diffchange 'p4 opened -c $1 | `awk 'BEGIN { FS = "#" } // { print "p4 diff " $2 }'` | csh';
AK
Don't use an alias, put it in a shell script and use the script's positional parameters.
Mark Thalman
A: 

The above answers your question but, if tile is read as diffing a directory on a change list it can be answered with the following:

p4 filelog ... | awk '
BEGIN {FS="[ /]";tc=999}
/^\/\// {fn=$NF;o=1;if (system("test -w " fn)) h=0; else h=""}
/^\.\.\.\ \#/ {if (h==0) h=$2;
  if ($4<=tc && o==1) {print "p4 diff -db -dw " fn h " " fn $2 " ;#"  $4;o=0}}' \
| sh

This will diff all the files in the directory against the changelist 999 it uses the "have" version if it has be checked out otherwise it uses the latest version.

this was tested with GNU Awk 3.1.3

Frobbit