Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a file in shelved change list in Perforce?

I edited a file and then shelved the changes in it with shelved changelist X. Now I edit another file. How can I add this file in already existing shelved changelist X or generate a new changelist containing changes in both files?

Thanks.

like image 499
ravi Avatar asked Aug 31 '12 06:08

ravi


People also ask

How do I shelve perforce files?

To shelve your files, right click the changelist and choose Shelve to display the Shelve dialog. Because there is no shelf for the default changelist, you will need to enter a description for a new pending changelist to shelve files if you are shelving from the default changelist.

Has shelved files Cannot submit?

Basics: To be shelved, a file must be checked out. However, you cannot unshelve a checked-out file. Submitting shelved files: You cannot submit.

What is p4 shelve?

The p4 reshelve command copies shelved files from an existing shelf into either a new shelf or one that has already been created. This command leaves the source shelf intact. If a file pattern is specified, p4 reshelve shelves the files that match the pattern.

What does p4 add do?

p4 add opens files within the client workspace for addition to the depot. The specified files are linked to a changelist. The command can add files to a new, empty depot or to a depot that already contains files. The files are added to the depot when the changelist is committed with p4 submit .


1 Answers

You don't have to unshelve, as @Dennis suggests, although that may be one way to do it.

For an unopened file you wish to add to an existing shelf, simply open that file into your existing shelve's changelist. For example, if your shelf is identified by changelist #1729, then do

p4 edit -c 1729 forgot_to_shelve.py

Then, shelve it:

p4 shelve -c 1729

If it turns out that the file already exists in the shelf but you wish to update it, then as usual, add -f:

p4 shelve -c 1729 -f

For a file that's currently opened that you wish to add to your existing shelf, you would first reopen that file into your existing shelf's changelist, before shelving as above:

p4 reopen -c 1729 forgot_to_shelve_and_currently_opened.py
p4 shelve -c 1729

Reference:

In order to add a file to a pre-existing shelve, the file must first be opened in the shelve's changelist; use p4 reopen to move an opened file from one changelist to another.

p4 shelve // Perforce 2013.3: Command Reference

like image 94
slackwing Avatar answered Nov 16 '22 03:11

slackwing