P4 unshelve files using branch mapping

虽然git还没用熟练,P4也得会用啊~

//

n Perforce, a codeline is a set of related files  for example, all the source code required to build your software product. Copying an edit from one file set to the other is called merging or copying. Copying a set of files to create a new codeline (or equivalent) is called making a branch or branching. Branching is performed using the Merge/Integrate feature. You can perform simple branches using a file mapping.

To ensure that complex branching is done in a controlled manner (for example, to prevent typographical errors when entering target directories or to make sure that complicated branches are performed correctly), you can create a branch mapping, which specifies the relationship between two codelines. When you branch, you can use the branch mapping instead of a file mapping. Branch mappings are displayed in the right pane on the Branch Mapping tab.

Note. Perforce Streams provide an alternative approach to managing codelines. For more information, see About Streams.

Work with branch mapping

To create a branch mapping, choose File>New>Branch Mapping... and enter the required information. To prevent the mapping from being changed by other users, check locked. To confine integration to closely related files, choose direct; to enable integration between distantly related files, choose indirect.

Use the View field to reflect the relationship between source and target codelines. For example, to create release 2 of Jam from the code in your main codeline, you might use the following view:

  //depot/jam_proj/... //depot/jam_r2.0/...

To view a branch mapping, go to View>Branch Mappings or click the View branch mappings Branch mapping button in the toolbar. Use the Filter pane at the top of the Branch Mappings tab to search for mappings by owner and branch mapping name (or part of the name). Double-click a branch mapping to view it.

To change a branch mapping, double-click it in the Branch Mappings tab to open the Branch Mapping dialog. Click Edit to enter your changes.

To delete a branch mapping, click the mapping you want to delete, then select Edit>Delete Branch branchname.

To integrate using a branch mapping:

  1. Right click the files you want to integrate and choose Merge/Integrate... The Merge/Integrate dialog is displayed.
  2. Select User branch mapping as your Merge method.
  3. Browse for the branch mapping you want to use. Select the branch mapping and click OK.
  4. In the Target field, specify where you want the source files integrated. The target must be a path that contains some or all of the paths identified in the branch mapping. In other words, the target can be a subset of the path specified by the branch mapping.
  5. Specify other options as desired:
    • Do not copy target files to workspace: by default, newly branched files are copied to the workspace. To prevent the files from being copied, check this option.
    • Enable baseless merges: to perform the integration even if a target file does not share a common ancestor with a source file, check this box.
    • Disregard previous integration history: force the integration on all revisions of source and target files, even if some revisions have been integrated in the past. Best used with a revision range.
    • Propagate source filetypes to target files: assign the source file's filetype to the target file. If this is not selected, the target file retain its filetype.
    • Reverse mappings in branch view: swap source and target mappings when performing this integration.
    • Enable integrations around deleted revisions: allow an integration that opens the target file for delete when the source file has been deleted, and allow an integration that branches a new target file that was previously deleted.
    • Do not get latest revision of selected files: don't automatically get the latest revision of target files before integrating. Use the current workspace revision instead.
    • Pending Changelist: to perform the integration using a changelist other than the default changelist, choose the desired changelist from this drop-down list.
  6. To preview the results of the operation, click Preview.
  7. To integrate the files using the selected branch mapping, click Merge.

//

遇到一个需求,别人提交的code shelve 到A branch pending,然后我在B branch抓到本地的code想要用他的这个shelve有点类似GIT上的cherry pick

P4 unshelve -s <CL>  -c<CL> -b branch1_to_branch2

http://stackoverflow.com/questions/20948905/how-to-unshelve-a-shelved-changelist-to-another-branch-prior-to-perforce-2013

首先要新建一个 branch mapping,格式是\\XXX\...  \\YYY\...,将XXX文件夹映射为YYY文件夹


XXX是别人shelve的branch,YYY是你要用的branch


找到别人的change,unshelve,选择unshelve using branch mapping,选择自己创建的branch map


操作成功后并不是这个改动才只是到了你的pending区,所以跟远程得原branch和你本地的branch还没构成联系


在pending中会看到别人的pending拿过来了

但是文件上有个问号,意思为needs resolve,发生冲突需要我们手动解决

右键有resolve选项卡,仔细阅读,有accept XXX选项是让你选择接受冲突双方的哪个


下面还有merge tool  还可以diff查看不同的地方


accpet后看看你本地的branch对应的文件改变了~

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

shenhuxi_yu

感谢投币,继续输出

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值