当前位置: 首页 > 工具软件 > P4A > 使用案例 >

[P4]p4 integrate/resolve/copy

鞠侯林
2023-12-01

p4 integrate/resolve/copy

目录

p4 integrate/resolve/copy

p4 integrate/p4 integ

p4 resolve  -am或-as参数

p4 copy

p4 change

p4 labelsync


p4 integrate/p4 integ

  • 功能:用于不同stream之间文件的合并,比如把文件 //HC/AT/sim/uvm/ttt.log覆盖到文件 //HC/BT/sim/uvm/ttt.log
  • 基本语法
  • p4 integrate [options] fromFileSpec[revRange] toFile
  •  Example
p4 integrate  //HC/AT/sim/uvm/ttt.log   //HC/BT/sim/uvm/ttt.log
 
p4 resolve -at //HC/BT/sim/uvm/ttt.log
 
p4 sumbit //HC/BT/sim/uvm/ttt.log
  • 注意:在执行integrate时,服务器会比较两个文件的差异,如果两个文件完全一样,则此操作失败;如果两个文件内容有差异,则需要执行resolve操作进行merge,此时,theirs是//HC/AT/sim/uvm/ttt.log

p4 resolve  -am或-as参数

  • -am表示accept merged,具体为:
  1. 如果theirs与base一致,接受yours,
  2. 如果yours与base一致,接受theirs,
  3. 如果yours和theirs都与base不同,但是yours和theirs没有冲突,接受自动merged的结果,
  4. 否则如果yours和theirs也有冲突,则忽略此文件。
  • -as比-am更严谨,不管yours与theirs是否有冲突,只要yours和theirs都与base有不同就忽略此文件。

-ay   Accept Yours, ignore theirs.

-at   Accept Theirs.


  • 解释下theirs,base和yours
  1. theirs: The head revision of the file in the depot.(P4 上的最新版)
  2. base: The file revision synced to the client workspace before it was opened for edit.(P4上open for edit之前的P4版本)
  3. 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 yoursn non-conflicting segments of yours are different than base.
n theirsn non-conflicting segments of theirs are different than base.
n bothn non-conflicting segments appear identically in both theirs and yours, but are different from base.
n conflictingn segments of theirs and yours are different from base and different from each other.

    

p4 copy

  • 基本语法

p4 copy [-c change] [-n -f -v -q] [-m max] fromFile[rev] toFile

Option                                                                Meaning
-m maxSpecify the maximum number of files to copy, to limit the size of the operation.
-nPreview the copy.
-qQuiet mode, which suppresses normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed.
  •  e.g.
 p4 copy  //HC/AT/sim/uvm/ttt.log   //HC/BT/sim/uvm/ttt.log

p4 change

  • 创建一个changelist
p4 change -o > change_spec.txt
sed -i "s/<.*>/<branch>/" change_spec.txt #修改描述
p4 change -i < change_spec.txt
  • p4 changes -s pending -u shaoxinw  //查看shaoxinw修改的状态为pending的changelist
Option                                                                Meaning
-m maxList only the highest numbered max changes.
-tDisplay the time as well as the date of each change.
  •  p4 info: 
User name: joe
Client name: joes_client
Client host: joes_workstation
Client root: /usr/joe/projects
Current directory: /usr/joe/projects/source
Client address: 192.168.0.123
Server address: p4server:1666
Server root: /usr/depot/p4d
Server date: 2012/01/28 12:11:47 -0700 PDT
Server uptime: 752:41:33
Server version: P4D/FREEBSD/2012.1/406375 (2012/01/25)
Server license: P4Admin <p4adm> 20 users (expires 2013/01/01)
Server license-ip: 10.0.0.2
Case handling: sensitive


p4 labelsync

  • Synchronize a label with the contents of the current client workspace.

p4 [g-opts] labelsync [-a -d -n] -l labelname [file[revRange]...]

  1. -d: Delete the label tag from the named files. 
  2. -a: Add the label to files that match the file pattern arguments, even if some of the files being labeled are deleted at their head revision.
  3. -n: Display what p4 labelsync would do without actually performing the operation.
p4 [g-opts] label -d [-f -g] labelname
p4 [g-opts] label -o [-t template] labelname
p4 [g-opts] label -i [-f -g]
  • Options
Option                                                                Meaning
-d [-f]Delete the named label if it's unlocked. The -f option forces the deletion even if the label is locked. (Deleting a locked label requires admin or super access.)
-fAllow the Update: field's date to be set. Can be used with either the -i option or the -t option for the same purpose.
-gIn distributed environments, use the -g option to control whether the label is local to an edge server, or globally available from the commit server.
-iRead the label definition from standard input without invoking the editor.
-o

Write the label definition to standard output without invoking the editor.

No files are actually tagged until p4 labelsync is invoked.

-t template

Copy label template's view and options into the View: and Options: fields of this label. You can specify a default label template using the template.label configure variable. If you do so, you do not have to specify this option.

 类似资料: