Perforce 为软件配置管理系统,简称P4。系统由服务器端,客户端组成,还包括若干中介服务器 (Proxy Server)。
上传的文件分为两类,一类是已经存在的公用文件,比如a ;另一个是自己新建的文件,比如b.
p4上传文件步骤:
详细的命令解读:https://www.perforce.com/manuals/v15.2/cmdref/p4_sync.html
p4v后图形界面的操作:https://gameinstitute.qq.com/community/detail/127465
https://blog.csdn.net/kuangyeliangguang/article/details/83791483
较好的可以参考的博客:https://blog.csdn.net/qq_31019565/article/details/86509905
1、p4 sync (-q静默模式,sync前要cd到相应的目录下,若只想sync某一个子目录,p4 sync name/... 或者sync某个文件 p4 sync file1)
2、p4 edit a (p4 识别我编辑了这个文件,处于opened状态,先p4 edit 文件才有写权限,之后可以通过gvim或者cp命令去修改覆盖文件)
3、p4 add b (告诉p4我自己增加了这个文件,一般先在本地mkdir或者直接cp文件,然后p4 add告知服务器这个client添加了这个文件)(若要在某个子目录下添加一个文件,而且这个子目录local不存在,使用p4 add a/b/c.sv会自己创建a/b/目录,其实在一想,我我可以现在本地mkdir -p a/b/c.sv ,在通过gvim/cp去更改文件,然后 p4 add即可)
4、p4 opened (查看我更改过的文件,此时会显示出 a b 两个文件)
5、p4 revert filename (把文件恢复到修改之前的版本,首先要 p4 edit filename , revert 才有效)
6、p4 submit -d "your comment"
7、执行完6 后,非常不幸地出现以下提示:
Merges still pending -- use 'resolve' to merge files.
Submit failed -- fix problems above then use 'p4 submit -c 74346' (若出现问题,想要查看,可以使用p4 submit -c 74346 > submit_c_74346_txt,在gvim查看)
个人暂时理解是我要上传的文件已经有人改过,我需要把我增加的部分merge进去,执行步骤8
8、p4 resolve a
出现提示要不要把你的和别人的merge在一起, 键入 am ,表示接受merge
9、执行步骤7出现的
p4 submit -c 74346(submit完成)。
10、p4 delete (delete,add ,edit,都为进入opened状态,但三者不能同时修改在一个文件上,想要delete整个子目录 p4 delete ./...,本地在rm -rf 掉)
11、p4 client (若要删掉client使用p4 client -d client_name一定是client名字而不是workspace的路径,,然后在把对应workspace的文件夹rm -rf掉)
12、添加client, 这里使用的脚本 mkpwa -s //depot/file1 file1_workspace
13、与stream有关的提交(不具有适用性,特定在目前搭建的版本库里使用)
1. p4 edit import.cif
2. gvim/cp文件做修改
3. cfg2spec -edit import.cif
4. p4 submit -d "description"
14.用diff进行比较的时候,推荐使用gvimdiff a/b/c.file1 d/f/g.file2
15、p4 client 可以查看和编写client的信息
16、p4 login 用于登录
以下为转载的别人的p4 resolve 的解释:https://blog.csdn.net/lbt_dvshare/article/details/86479997
p4 resolve
-am或-as参数
-am表示accept merged,具体为如果theirs与base一致,接受yours,如果yours与base一致,接受theirs,如果yours和theirs都与base不同,但是yours和theirs没有冲突,接受自动merged的结果,否则如果yours和theirs也有冲突,则忽略此文件。
-as比-am更严谨,不管yours与theirs是否有冲突,只要yours和theirs都与base有不同就忽略此文件。
-ay Accept Yours, ignore theirs.
-at Accept Theirs.
--------------------------------------------------------------------------------------------------------------------------------------------
解释下theirs,base和yours
theirs: The head revision of the file in the depot.(P4 上的最新版)
base: The file revision synced to the client workspace before it was opened for edit.(P4上open for edit之前的P4版本)
yours : The revision of the file in the client workspace(当前open for edit编辑的local file)
举个栗子:某个文件你在第3版时open for edit ,别人在此时进了一版,即最新版时第4版;此时,第四版是theirs,第三版是base,基于第三版编辑的local file是yours.
-------------------------------------------------------------------------------------------------------------------------------------------
在执行p4 resolve 时会show出diff的结果,比如
Diff Chunks: 2 yours + 3 theirs + 5 both + 7 conflicting
The meanings of these values are:
Count | Meaning |
n yours | n non-conflicting segments of yours are different than base. |
n theirs | n non-conflicting segments of theirs are different than base. |
n both | n non-conflicting segments appear identically in both theirs and yours, but are different from base. |
n conflicting | n segments of theirs and yours are different from base and different from each other. |
p4 integrate 的使用 https://blog.csdn.net/iteye_13237/article/details/81689248