Rohit Jain
Rohit Jain

Reputation: 3224

How does one diff between two pending changelists in perforce?

I have a couple of similar pending changelists based on top of a branch of code and off the same workspace in perforce. I need to diff between them and (eventually) merge them together into one changelist. What is the fastest and simplest way to go about it? I would rather avoid creating a temporary branch.

Upvotes: 4

Views: 4445

Answers (3)

javagrendel
javagrendel

Reputation: 91

Try

p4 diff2 //repo/path/to/file@=shelf1 //repo/path/to/file@=shelf2

To compare all files:

p4 diff2 //repo/path/...@=shelf1 //repo/path/...@=shelf2

where 'shelf1' and 'shelf2' are your shelved changelists.

Caveat: you can only do a textual diff with 'p4 diff2'

Upvotes: 1

RJFalconer
RJFalconer

Reputation: 11662

The general answer to your question (where merging is not the goal) is that it's not possible with a p4 command.

You have to unshelve both changelists to different workspaces then run an external diff tool on the two workspace directories.

Upvotes: 4

Bryan Pendleton
Bryan Pendleton

Reputation: 16359

Recent versions of the server support unshelving a change into a workspace with opened files, and resolving the merge.

So, assuming your server is recent enough, you simply:

  1. Shelve the changes
  2. Start with a clean workspace
  3. Unshelve one of the changes into that workspace
  4. Unshelve the other change into the same workspace
  5. Resolve any merged changes that result.
  6. Carefully examine your diffs prior to submit, to ensure you have the changes you desire.

Upvotes: 5

Related Questions