Perforce - create patch file with differences versus version

In Perforce, how can I create a patch file that has the changes that are in the file currently saved, compared to the version? The instructions for the GUI client or CLI client will be great.

I see how to get the difference between the two change lists, but not how to simply get the difference between the last change list and the current state of the files. In addition, I see that in the GUI client, I can right-click on the file and select "Diff Against Have Revision" from the context menu, which shows me what I'm looking for, but I cannot figure out how to get it in file.

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

+8
diff perforce p4v
source share
3 answers

I think p4 diff -du FILE > patch.diff should do what you want.

+9
source share

Single file

p4 diff -du file > file.patch.diff

Each file

p4 diff -du > patch.diff

+3
source share

The problem with p4 diff is that it does not account for new files. Also, you cannot receive files that are only in a specific list of pending changes.

If there is a pending change in the change list, you can use the open source patcher tool that I created for my projects. You can directly download github from this link .

If you want to check the source, go to github repo .

The documentation for the tool can be found here .

+3
source share

All Articles