Sunday, 8 June 2014

Perforce Working with Chang-lists :

Perforce Working with Chang-lists :


Open files won't affect the depot until we submit them. And when we submit files to the depot it means we are changing our source code and it generates changelist. What we submit to the depot is not an individual file but the entire pending changelist.

1. How to submit changes

#p4 submit

submit commans is used to apply the changes to the depot. By default, it operates on the default pending changelist
This will open submit spec from, similar to p4 client, but it comes with prefilled list of files in the changelist we just  have to edit the description for the changelist.

2. How could i prevent unchanged files from being submitted

#p4 revert -a

Actually revert command reverts changes made to files those are not changed.
Here, -a flag causes revert only reverts files those are not changed

3. How do I  create seperate changelists.

Changelists are meant to document files changed together as a single unit of work. However, its easy to end up with unrelated files in default pending changelist. If it happens, consider splitting files in to changelists that can be submitted saperately.

#p4 change

change command is used to create seperate changelist. The command brings up spec from just like submit. The form will list all files opened in default changelist. simply fill in a description and save them to move files to new changelist.
Saving form doesn't submit changes instead it generates another change number.

4. How do I know which changes are pending.

#p4 changes -s pending

p4 changes -s pending commands shows all changes those are pending.

#p4 changes -s pending <client name>

Above commands shows changes those are pending for given client

5. How to move files from one changelist to another

once we have more than one pending changelist, we can use reopen command to juggle open files between them

#p4 reopen -c default <filenames>
or
#p4 reopen -c <change no> <filen name>

6. How do i know what's there in pending changelist?

#p4 opened -c <change no>

opened command shows files opened for pending changelist
-c flag takes change no to show up what's in changelist

7. How do I submit pending changelist

#p4 submit -c <change no>

-c flace takes change no to submit

8. How could I delete empty pending change list 

#p4 change -d <change no>

-d flag deletes empy changelist

9. How can I submit subset of opened files.

#p4 submit <file spec>
#p4 submit //depot/Release1-2010-X.2/bbb/...

By supplying file spec to submit command perforce will split default changelist in to two. The first new chagelist, containing the files that mat chwith file spec, is submitted. And rest of other files will remain open.

10. How do I know which files need to be resolved.

#p4 resolve -n

p4 resolve -n command list files required to be resolved


11. How to cancel pending changelist having more than one file

- List out the files in changelist
- Filter out the output of the command
- verify filtered output against files to be reverted
- List out files going to be affected using revert command
- Apply revert command on all those files

#p4 opened -c 16127
#p4 opened -c 16127 | awk -F "#" '{print $1}'
#p4 opened -c 16127 | awk -F "#" '{print $1}' | tr '\n' ' '
#p4 revert -n `p4 opened -c 16127 | awk -F "#" '{print $1}' | tr '\n' ' '`
#p4 revert `p4 opened -c 16127 | awk -F "#" '{print $1}' | tr '\n' ' '`

This will cancel pending changelist

12. Backing out recent changes.

For example, to back out changes 1245.

1. Get the list of files in the changes lists 1245

#p4 files @=1245


2. sync with previous change list files.

#p4 sync @1244

3. Now open files affected by changes list 1245, edited for edit, deleted for add and added for delete

#p4 files @=1245 | sed -n -e "s/#.* - delete - .*//p" | p4 -x- add
#p4 files @=1245 | sed -n -e "s/#.* - edit - .*//p" | p4 -x- edit
#p4 sync
#p4 files @=1245 | sed -n -e "s/#.* - add - .*//p" | p4 -x- delete

4. Now resolve your files with perforce files.

#p4 resolve -ay

5. Submit them

#p4 submit





No comments:

Post a Comment