Solution
p4 opened -c 999 | sed -e 's/#.*//' | p4 -x - diff
Explanation
p4 -x
gives you xargs
like ability without having to use xargs
. From p4 help utils
:
The -x flag instructs p4 to read arguments, one per line, from the
specified file. If you specify '-', standard input is read.
So you can almost just "take the output of p4 opened -c 999 and pipe it to p4 diff" as suggested in the question. The one tricky part is that the output of p4 opened
contains revision numbers and explanatory text after the name of each open file e.g.
//depot/example#123 - edit change 999 (text) by day@office
//depot/new-example#1 - add change 999 (text) by day@office
But we can run this through a simple sed -e 's/#.*//'
to strip off everything from the #
onwards to leave just the paths:
//depot/example
//depot/new-example
which can then be consumed from standard input and fed to p4 diff
thanks to p4 -x -
.
If you have #
in the names of any files then you'll need to get more clever with the sed
command. And see a psychiatrist.
p4 describe -S -du 999
– Whomp