Diff between two branches in a client workspace

diff()perforce

I have two branches in my local workspace. I need to take a diff between them and capture the filenames in a text file.

I looked into diff and diff2

p4 diff

gives the diff between a branch in the local client workspace and it's counterpart on the server

p4 diff2

can only be used to get the diff between two branches which are on the server.

By the way, if I do "Diff Against" on the two branches on the server through p4v client, I am able to see the list of the diff files. But I don't see anything there which would import the filesnames to a text file.

But if I try p4 diff2 through the command line on the two branches on the server, i get - protected namespace - access denied.

Any pointers will be much appreciated.

Best Answer

If you p4 sync both branches to the required version first, then all the files are on your disk and available to the regular diff command (not a p4 sub-command) - see the man page.

For example:

diff -qr branch1 branch2

Might give you output like:

Files branch1/newfile and branch2/newfile differ
Only in branch1: newfile2
Related Topic