·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP.NET网站开发 >> Perforce与SourceInsight,VisualStudio集成

Perforce与SourceInsight,VisualStudio集成

作者:佚名      ASP.NET网站开发编辑:admin      更新时间:2022-07-23

转自:http://shashanzhao.com/archives/837.html

1.Perforce

 

首先需要为perforce设置系统环境变量,以便perforce命令行可以正常使用.

环境变量名
P4CLIENT 填写你的workspace的名字,例:code_myname
P4PORT 填写perforce服务器地址和端口号,例:172.23.3.3:1666
P4USER 填写你的用户名,例:myname
P4DIFF(可选) 填写比较工具的路径,例: d:\PRograms\BeyondCompare\BCompare.exe,如果使用perforce自带的比较工具就不用设这个环境变量了
P4PASSWD 填写登陆的密码,例:passWord

 

 

2.集成至Source Insight

 

1. Source Insight菜单Options->Custom Commands,

选择以下各个Command,填写各个Command的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

其中Compare with Current命令需要自己添加.

点击Add按钮, 填入命名: Compare with Current即可添加一条.

另外Compare with Current必须在check out状态下才能比较,比较的就是未check out出来时的文件.

2. 填完后Custom Commands窗口不要关,点击Menu按钮

将刚才的那些命令添加到work菜单下.

操作方法:

a.右边的Menu组合框中选择Work

b.左边窗口选中命令,右边窗口选中<end of menu>,

c.点击Insert按钮把命令插入work菜单下

d.重复b-c,直至所有命令添加完毕

e.按下OK按钮

3. 打开文件,在work菜单下就可以选择Check Out, Undo Check Out, Sync File to Source Control Project, Compare with Current等菜单来操作文件了

另外也可以打开Source Control工具栏,通过主菜单View->Toolbars->Source Control,

在Source Control工具栏上默认有Check Out, Undo Check Out, Sync File to Source Control Project等按钮.

 

3.集成至Visual Studio

 

1. Visual Studio菜单:工具->外部工具,

添加以下各个工具,填写各个工具的标题,命令和参数.注意添加时选中使用输出窗口.

标题: 命令: 参数:
Check Out p4.exe的路径,例:C:\Program Files\Perforce\p4.exe edit $(ItemPath)
Undo Check Out p4.exe的路径 revert $(ItemPath)
Sync File to Source Control Project p4.exe的路径 sync $(ItemPath)
Compare with Current p4.exe的路径 diff –f $(ItemPath)

2. 打开代码后,在”工具”菜单下可以找到新增加的菜单.

3. 还可以在”工具”->”自定义”中把外部命令拖到工具栏上,方便使用.

注意:在自定义中只显示外部命令+数字,所以先要看一下新加的外部命令排在第几个,然后选择对应的外部命令(例:外部命令10)拖到工具栏上即可.另外各个版本的Visual Studio的自定义可能会有些区别,我所测试的是VS2005.