How to view Shelved P4 Changes?
Asked Answered
C

9

62

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?

Croft answered 13/10, 2011 at 17:43 Comment(0)
L
66

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.

Labret answered 13/10, 2011 at 18:23 Comment(7)
Thanks! And if I want to download those files (which have shelved changes in my P4 workspace, what would be the command?Croft
You could just use P4V for thatIyar
Thanks for the helpful answer. Quite annoying that a new argument is necessary to view shelved changes. </rant>Impassive
When I enter p4 revert -c 2345 I get Missing/wrong number of arguments. The "files" argument is mandatory, although I would expect it to default to all the files in the changelist.Yirinec
please, tell me if I wrong: there is a problem with 'p4 describe -S 1234' - it shows content only for modified files, but not newly added. But anyway THANK YOU @jhwistWrath
p4 describe -S -du3 -O 1234 will Nice diff with descriptionTrickle
If you don't like the view, try p4 describe -du -S 1234 | colordiff | less, trust me you will like this, which looks similar to git diffShortage
N
34

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.

Nones answered 11/6, 2013 at 20:40 Comment(2)
It is actually easier to hit Ctrl-G and enter the changelist numberFusilier
After going to Pending and searching for the person's username, I added the Date column and sorted by most recent to see all of their shelves.Sacco
M
14

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

Mirepoix answered 3/7, 2015 at 8:45 Comment(0)
C
11

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.

Chinchilla answered 25/10, 2013 at 1:7 Comment(2)
The p4 print / p4 diff2 method is especially useful when you cannot unshelve the file locally due to it being locked.Jeremiah
thanks for point out @= rather than @ to get shelved fileTengdin
G
9

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.

Geber answered 25/4, 2018 at 21:48 Comment(2)
plus1 Last line really helps.Messenia
++ :) :) :) :) :)Integrated
J
6

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.

Jovitta answered 1/10, 2015 at 13:59 Comment(0)
L
2

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 '(?=//).*(?=#)'
Leblanc answered 13/10, 2011 at 17:44 Comment(3)
p4 describe -sS does the job with a little less hassle. The lower case s restricts the diffs from being displayed.Jovitta
-s still shows the changelist description. This answer is the best given "if you want to see only the list of files"Griffe
With this method you still need to use -sS, because otherwise each file will appear twice in the outputPlatysma
E
2

In P4V UI, select

Search - > Go To

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

Energy answered 2/8, 2016 at 16:41 Comment(0)
S
0

You may try

p4 -ztag describe <changeno>

The description contains a string called '... shelved' if it is shelved.

Shutout answered 17/10, 2022 at 21:32 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.