Transferred from: http://shashanzhao.com/archives/837.html
1.Perforce
You first need to set the system environment variable for perforce so that the perforce command line can work correctly.
Environment variable Name |
Value |
P4client |
Fill in your workspace name, example: Code_myname |
P4port |
Fill in the Perforce server address and port number, for example: 172.23.3.3:1666 |
P4user |
Fill in your user name, example: MyName |
P4diff (optional) |
Fill in the path to the comparison tool, for example: D:\Programs\BeyondCompare\BCompare.exe, if you use the Perforce-Band comparison tool, you don't have to set this environment variable. |
p4passwd |
Fill in the login password, example: password |
2. Integration into source Insight
1. Source Insight menu Options->custom Commands,
Select each command below to fill in the command's run.
Command: |
Run: |
Check out |
P4 Edit%f |
Undo Check out |
P4 revert%f |
Sync File to Source Control Project |
P4 Sync%f |
Compare with current |
P4 diff–f%f |
Where compare with the current command needs to be added by itself.
Click the Add button and fill in the name: Compare with the current to add one.
In addition compare with the current must be in check out state in order to compare, compare is not check out when the file.
2. After filling out the custom commands window do not close, click the menu button
Add the commands you just made to the work menu.
Operation Method:
A. Select work in the menu combo box on the right
B. The left window selects the command, and the right window selects <end of Menu>
C. Click the Insert button to insert the command into the work menu
D. Repeat the b-c until all commands have been added
E. Press the OK button
3. Open the file, you can select check out under the Work menu, Undo check out, Sync file to Source Control Project, and Compare with the current menu to manipulate the files.
Alternatively, you can open the Source Control toolbar and View->toolbars->source control from the main menu,
On the Source Control toolbar, there are check out defaults, Undo check out, and Sync File to Source control project buttons.
3. Integration into Visual Studio
1. Visual Studio Menu: Tools, External Tools,
Add the following tools to fill in the titles, commands, and parameters for each tool. Note When adding the Use Output window.
Title: |
Command: |
Parameters: |
Check out |
P4.exe Path, example: C:\Program files\perforce\p4.exe |
Edit $ (Itempath) |
Undo Check out |
Path of the P4.exe |
Revert $ (Itempath) |
Sync File to Source Control Project |
Path of the P4.exe |
Sync $ (Itempath) |
Compare with current |
Path of the P4.exe |
Diff–f $ (Itempath) |
2. After opening the code, you can find the newly added menu under the Tools menu.
3. You can also drag external commands to the toolbar for easy use in tools, custom.
Note: only external commands + numbers are displayed in the customization, so take a look at the new external command first, then select the corresponding external command (example: External command 10) and drag it to the toolbar. There may be some differences in the customization of different versions of Visual Studio, What I'm testing is VS2005.
Perforce with Source Insight, Visual Studio integrates