I generated a patch some time ago using the p4 diff
command.
However, now that I want to apply it, I realize that there is no way to apply a patch in Perforce.
Since I did not use the -du
option, the patch is in that obscure perforce format and can't be applied with patch(1)
. The original changes have been lost. Also, that patch is over 300kb long so manual editing isn't really an option.
What are my options ? Are there patch converters, or some Perforce extension allowing the application of these kind of patchs ?
Perhaps Perforce's diff output format has changed, but @RumburaK's answer didn't work for me.
I had to modify it to convert the ====
header to diff's +++
and ---
header format.
sed -Ee 's|==== (//.*)#[0-9]+(.*)|+++ \1\n--- \1|' < infile.txt > outfile.txt
infile.txt was generated with the following command (where 12335 was a shelved changelist): p4 describe -du -S 12345
outfile.txt was applied with the following command: patch -p3 -l < outfile.txt