当前在 perforce 中签出目录/文件的版本
我正在尝试自动化保存在 perforce 中的项目的一些构建。我想提取当前的变更列表编号作为标记构建版本的一种方式。
此命令:
p4 changes -s submitted ... | head -1
非常接近于执行我需要的操作,除非我没有从 perforce 中签出最新版本。上面的命令(似乎)显示所有更改列表,而不仅仅是我签出的更改列表。
有没有办法获取最近同步到变更列表的变更列表编号?
注意:我有更多的 CVS / git 背景,所以我的术语可能不正确。
I'm trying to automate some builds for a project kept in perforce. I'd like to extract the current changelist number as a way of tagging the build version.
This command:
p4 changes -s submitted ... | head -1
goes very close to doing what I need, except in the case where I don't have the latest version checked out from perforce. The above command (appears to) display all the changelists, not just the ones in my check out.
Is there a way to get the changelist number of the most recently synced-to changelist?
Note: I come from more of a CVS / git background so my terminology may be off.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试运行“p4 cstat ...”。这会告诉您,对于影响“...”中文件集的每个变更列表,您是否拥有该变更列表、需要它还是部分同步。
Try running 'p4 cstat ...'. That'll tell you, for every changelist that affects the set of files in '...', whether you have that changelist, need it, or have it partially synced.
我同意“p4 cstat”方法。
我使用它的方式如下: p4 cstat| p4-版本.awk
这是以下脚本:
I agree with the "p4 cstat" approach.
I use it like: p4 cstat| p4-version.awk
which is the following script:
虽然我不确定它是否适用于这个问题,但我想展示一种解决方案,可以让您获得最新的变更列表,直到您无缝同步的变更列表(即您可以在客户端上同步新的变更列表,而忽略一些旧的变更列表) ,例如,如果您自己提交了更改,而之前没有同步其他人提交的一些更改)。
使用以下命令列出未同步到客户端的所有更改:
如果提取该列表的最后一个更改列表并减去 1,您将获得已无缝同步所有内容的更改列表编号:
Though I am not sure if it is applicable for this question I want to show a solution that lets you get the latest changelist up to the one you have synced without gaps (i.e. you can have synced new changelists on your client leaving out some older ones, for example if you have submitted changes yourself without previously syncing a few changes that were submitted by other people).
With the following command you list all changes not synced to your client:
If you extract the last changelist of that list and subtract 1 you get the changelist number up to which you have synced everything without gaps:
要查找客户端上的最新更改列表,请使用以下命令:
客户端名称可以充当标签。
To find the latest changelist on your client, use this command:
Client names can act like labels.
我认为以下内容将满足您的要求:
p4 fstat
非常好,因为它不仅需要一个过滤器(通过-F
选项),还需要一个字段选择参数(使用-T
选项)。I think that the following will do what you want:
p4 fstat
is really nice in that it takes not only a filter (via the-F
option) but a field selection parameter (using the-T
option).您想要的是文件的“haveRev”:
然后您可以像这样查找更改号:
请注意,我使用了签出树的特定文件。
What you want is the 'haveRev' of your file:
and then you can look up the changenumber like so:
Note that I used a specific file of the checked out tree.