11.13.2013

Perforce Cheat Sheet

1. New client spec for workspace
$ p4 client
2. Populate workspace with files from server
$ p4 sync
$ p4 sync * - only files from current dir
$ p4 sync ... - current path, all folders and files underneath
$ p4 sync -f filename - force the sync, override no clobber (lose all local changes)
$ p4 sync @490807 - sync to changelist number
$ p4 sync @=490807 - sync only the files revised within that changelist
3. Check out a file for edit
$ p4 edit filename
4. See checked out files
$ p4 opened
$ p4 have filename - what version you have
$ p4 filelog filename - check history
5. View local changes
$ p4 diff
$ p4 diff filename | p4c.rb - colored diff
$ p4 diff -db filename - disregard whitespace
$ p4 diff -t filename - even though files aren't text
6. Create new changelist
$ p4 change
$ p4 change -u changelist_number - update submitted changelist
7. Add files for addition to the depot
$ p4 add
$ p4 add -c change_number -f filenames - add files to changelist
$ p4 add -f filenames - add files to default changelist
$ p4 add -c change_number * */* - add files in current dir and next dir to default changelist
$ "find . -type f | p4 -x - add" - cmd inside quotes would find all files in a directory structure and add them all in
8. Get info about a changelist, listing files that are included
$ p4 describe change_number
9. Get a list of your changes
$ p4 changes -u username
$ p4 changes -u username -s pending
10. Discard changes made to open files
$ p4 revert -c change_number - reverts only those files in the specified changelist
$ p4 revert filename - reverts only this file
11. Submit changes for code review
$ /auto/tools/bin/post-review change_number
12. Checkin your changes
$ p4 submit
$ p4 submit -c change_number
13. Delete pending changelist
$ p4 changes -u username -s pending
$ p4 revert -c 12345 //... - revert all files in my pending changelist 12345
$ p4 change -d 12345 - delete the now-empty changelist
14. Print detailed information about file revisions.
$ p4 filelog filename
15. Add opened files to a specific changelist
$ p4 reopen -c 431494 */*
16. Get specific change information
$ p4 changes //prod/main/...\@445029,445029
Change 445029 on 2014/08/10 by sdc@main:sdc 'Integrate change 444241 from 5.'
17. Move (or rename) a file from one location to another
$ p4 move deploy/deploy_change util/deploy_change
18. Move a directory
$ p4 edit 5.5/*/baseline.xml
$ p4 move 5.5/... 5.5_old/...
18. Take a peek at the branches available
$ p4 branches | grep "5\.6\.0"
19. Delete file
$ p4 delete filename
20. Change file type into executable
$ p4 edit -t +x watchdog

No comments:

Post a Comment