Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perforce - create patch file of differences against have revision

Tags:

diff

perforce

p4v

In Perforce, how can I create a patch file which has the changes that are in the file as currently saved, compared to the have revision? Instructions for either the GUI client or the CLI client would be great.

I can see how to get the diffs between two changelists, but not how to just get the difference between the last changelist and the current state of the files. Additionally, I can see that in the GUI client, I can right-click on a file and select "Diff Against Have Revision" from the contextual menu, which shows me what I'm looking for, but I can't figure out how to get that into a file.

I'm basically looking for the equivalent of what git diff <file> > patch.diff does in Git-land.

like image 597
Garrett Albright Avatar asked Oct 31 '13 17:10

Garrett Albright


1 Answers

The problem with p4 diff is that it doesn't take into account of new files. Also you can't get files that are only in a certain pending change list.

If there is a pending changelist, you can actually use an open source perforce patcher tool, which I have created for my project needs. You can directly download from this link of github.

In case you want to checkout the source, go to the github repo.

Documentation for the tool can be found here.

like image 91
Buddha Avatar answered Nov 09 '22 21:11

Buddha