Pergunta

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.

Foi útil?

Solução

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

Outras dicas

Single file

p4 diff -du file > file.patch.diff

Every file

p4 diff -du > patch.diff

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top