[SCM] source code management-perforce Advanced Operations

Source: Internet
Author: User
Tags perforce
The following operations are based on p4v.

 

1 P4 refresh all

In some cases, some modifications cannot be updated in p4v in real time. In this case, p4v refresh all can be used.

You can also right-click any item to find refresh-related operations. For example, if you delete or add files in the local directory, the file cannot be reflected in p4v in time. You can right-click the refresh option in the workspace directory. Of course, other changelist, client, and depot have corresponding refreash.

Operation: View-> refreash all

 

2 P4 rollback

Used to undo submitted changes or restore them to a previous changelist.

Use revert unchanged files or revert files if no modifications are submitted (that is, pending changelist on the local machine.

Operation: for example, restore/Depot/projectb to version (changelist) 14, right-click/Depot/projectb, and then click rollback. Set changelist to 14 on the rollback dialog, then directly submit.

 

3 P4 shelve

Shelve is a new function after P4 2009. The P4 server and P4 client must be supported at the same time.

The shelve operation is used to temporarily store ongoing work to the perforce server, but does not submit a changelist.
Shelve usage:
When you perform multiple development tasks on some files at the same time (for example, you must first process jobs with higher priority or test on other platforms before submitting ).
Or code review between developers before submission.

 

P4 shelve is equivalent to attaching your modifications to the P4 server rack at zero time.
P4 unshelve is equivalent to overwriting the modification from the P4 server shelf to the local workspace and adding it to pending changelist.

 

Operation:

1) The BBB user needs the shelve file // depot/projectb/file2.txt, right-click the file // depot/projectb/file2.txt, and then click shelve. For example:

2) The following figure shows the BBB user shelve file // depot/projectb/file2.txt:

3) after you log on with another user AAA, AAA may not use the same workspace (client) as BBB ). For example:

4) switch to the BBB user under the AAA user to view the BBB user's shelve. In this case, you can use diff against or directly open the file to review the BBB user's modifications, which is equivalent to code review.

You can also use unshelve to apply the modifications of BBB users to the workspace of AAA users and add them to the pending changelist of AAA.

5) when the AAA user switches to the BBB user after logon, The unshelve procedure is as follows:

6) After the AAA user unshelve the BBB's shelve, the BBB modification is added to the default changelist of AAA, as shown below:

 

 

4 P4 lock/unlock

Lock the files in the local pending changelist to prevent others from modifying the same files when they checkout, until they unlock or submit.

We know that P4 is the source code management based on the merge mechanism, and the P4 lock command is equivalent to the previous source code management tool based on the lock mechanism.

Operation: Right-click a pending changelist or some checkout files and choose lock or unlock.

 

5 P4 rename/move

Directly modify the name of a file on the perforce server or move the file to the directory. It is equivalent to using Delete + Add + Submit.

 

6. view the specified changelist. The operation is Ctrl + G.

 

Complete!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.