How to view Shelved P4 Changes?

PerforceShelve

Perforce Problem Overview


One of our team member (located in different region) has shelved changes in P4 with changelist 1234.

Now, if I want to see what files are modified snf what are the changes, how can I do this?

What is the P4 command that I should use to see the changes made by our team member?

Perforce Solutions


Solution 1 - Perforce

p4 describe -S 1234 should to the trick, see the documentation on describe.

To see the file content you would unshelve the files into your workspace (assuming you have a workspace for the same project your colleague is working on).

Create a new (empty) changelist with p4 change (results in e.g. 2345), then use p4 unshelve (docu) to get the modified files to your workspace:

p4 unshelve -s 1234 -c 2345

If you don't want the modified files in your workspace any longer, you can p4 revert -c 2345 them.

Solution 2 - Perforce

Using the GUI, go to Pending and remove all filters except by user, where you will put the other developer's ID. From there you should be able to see her Changelists, including the ones having shelved files. Right click on the Shelved Files icon and select Unshelve. You will have to have a workspace active that includes the files that you are trying to unshelve.

Solution 3 - Perforce

Using UI client, press Ctrl+G. Dialog window is appears. Select Changelist in combobox and input number of changelist.

Solution 4 - Perforce

Let's assume that changelist 123456 is the shelved changelist in question. As a previous answer mentioned, the way to list the files are associated with that changelist is via the p4 describe -s <changelist> command. Like so:

$ p4 describe -s 123456
Change 123456 by john.doe@JohnsBranch on 2013/10/24 15:38:10 *pending*

    [Shelving my changes for Jane.]
    Fix memory corruption caused by uninitialized pointer.

Affected files ...

... //depot/branches/JohnsBranch/kernel/vm/pageutils.c#1 edit

Once you know the file(s) in question, there are a couple of ways to diff the files without a corresponding workspace. Method #1 is to use p4 print:

$ p4 print -q //depot/branches/JohnsBranch/kernel/vm/pageutils.c#1       > /tmp/old
$ p4 print -q //depot/branches/JohnsBranch/kernel/vm/pageutils.c@=123456 > /tmp/new
$ diff /tmp/old /tmp/new    # Or use kdiff3, tkdiff, etc.
          ...
  <diff output here>

The other method is to use p4 diff2:

$ p4 diff2 //depot/branches/JohnsBranch/kernel/vm/pageutils.c#1 //depot/branches/JohnsBranch/kernel/vm/pageutils.c@=123456
          ...
  <diff output here based on Perforce server's diff algorithm>

Both methods can be easily incorporated into the scripting language of choice.

Solution 5 - Perforce

jhwist's solution is good if you want to see the files' diffs.

If you want to see just the shelved files, use p4 describe -sS 1234.

The lower case s restricts the output from including file diffs.

Solution 6 - Perforce

If you wanted to see the actual content of the files, you could use:

p4 print <file>@=<shelved_change>

The @= means to look at the shelved change, where as @ means to look at the change.

Solution 7 - Perforce

If you want to see only the list of files inside a ChangeList (whether it's a shelve, pending or submitted CL), without extra data, grep the result:

p4 describe -S 12345 | grep -oP '(?=//).*(?=#)'

Solution 8 - Perforce

In P4V UI, select

Search - > Go To

then choose type of changelist (in your case 'Pending changelist'), enter changelist number and click "OK".

Categories
Recommended Perforce Solutions

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMikeView Question on Stackoverflow
Solution 1 - PerforcejhwistView Answer on Stackoverflow
Solution 2 - PerforceMatthew WhiteView Answer on Stackoverflow
Solution 3 - PerforceSergey MorozovView Answer on Stackoverflow
Solution 4 - PerforcetroydjView Answer on Stackoverflow
Solution 5 - Perforceuser1167662View Answer on Stackoverflow
Solution 6 - PerforceNateWView Answer on Stackoverflow
Solution 7 - PerforceNoam ManosView Answer on Stackoverflow
Solution 8 - PerforceTomasz MaczyńskiView Answer on Stackoverflow