本文介绍了确定在 Perforce 中同步到的最后一个更改列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

偶尔出现的一个问题是,确定您上次在 Perforce 中同步到的更改列表的最佳方法是什么.这通常用于自动构建系统将更改列表编号注入修订信息等操作.

A question that occasionally arises is what is the best way to determine the changelist that you last synced to in Perforce. This is often needed for things like injecting the changelist number into the revision info by the automatic build system.

推荐答案

对于自动构建系统,我建议相反:您应该首先使用以下方法从服务器获取最新的更改列表:

I recommend the opposite for automatic build systems: you should first get the latest changelist from the server using:

p4 changes -s submitted -m1

然后同步到该更改并将其记录在修订信息中.原因如下.尽管 Perforce 建议使用以下内容来确定工作区的变更列表已同步:

then sync to that change and record it in the revision info. The reason is as follows. Although Perforce recommends the following to determine the changelist to which the workspace is synced:

p4 changes -m1 @clientname

他们注意到一些问题:

  • 这仅适用于您尚未从相关工作区提交任何内容的情况.
  • 客户端工作区也可能未同步到任何特定的更改列表.

还有一个他们没有提到的问题:

and there's an additional gotcha they don't mention:

  • 如果发生同步的最高更改列表从工作区中严格删除了文件,则将报告次高更改列表(除非它也严格删除文件).

如果您必须先同步然后再记录,Perforce 建议运行以下命令来确定您是否被上述问题所困扰;它应该表明没有同步或删除任何内容:

If you must sync first and record later, Perforce recommends running the following command to determine if you've been bit by the above gotchas; it should indicate nothing was synced or removed:

p4 sync -n @changelist_number

这篇关于确定在 Perforce 中同步到的最后一个更改列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 18:31