How to add a file in shelved change list in Perforce?
Solution 1
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
Solution 2
You can unshelve the changelist to your client, add the file, and then shelve it again. It will keep the same changelist number as changelists are only renumbered (if required to maintain chronological order) on submit.
Basically, think of a shelved changelist as a local pending changelist that you have just put aside for a moment.
ravi
Updated on September 15, 2022Comments
-
ravi over 1 year
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 changelistX
or generate a new changelist containing changes in both files?Thanks.
-
ravi over 11 yearsI want to do it in already existing client from which I created shelved list. I am unable to create/update changelist containing changes in both files.
-
Dennis over 11 yearsI don't understand what your problem. Why are you unable? Do you get an error? If so, please post it.