免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5119 | 回复: 1
打印 上一主题 下一主题

[ 原创 ] 在Perforce中创建Label [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-31 17:15 |只看该作者 |倒序浏览
作者:scmroad     出自:配置管理之路 http://bbs.scmroad.com

平时我们说创建一个label,就是说我创建了一个标识,并且这里边含有所需要文件的一个快照.

Perforce也有标签(label)这个概念,却偏偏把我们通常理解的意思给分成了两个部分.
1. 创建一个label
2. 把某个(或者多个)版本的某些文件和这个label进行关联.

而且做这两个动作的命令还不一样.所以容易让人混淆.这里我们来澄清一下.
p4 label        To create or edit a label
                创建或者编辑标签
p4 labels        To list all labels known to the system(Display list of defined labels).
                列出系统中所有的标签
p4 labelsync    To tag revisions in your client workspace with a label
                用一个标签(label)标识客户端工作空间的修订版本
                Synchronize a label with the contents of the current client workspace.
                用当前客户端工作空间中的内容来同步一个标签中的内容.
                就是说,让标签中的内容和本地工作空间中的内容一样.这个动作会更新标签中的内容.
               
p4 tag            To create a label and tag files with the label
                创建一个标签(label),并且把相应的文件和这个标签(label)进行关联.这个命令才是我们平时所讲的用来打label的命令.
               
然后我们来仔细看看p4 tag的用法.通俗易懂的大家都能看懂.把一些重要的地方,我翻译了一下.
p4 tag
Synopsis
Tag files with a label.

Syntax
p4 [g-opts] tag [ -d -n ] -l labelname file[revRange]...

Description
Use p4 tag to tag specified file revisions with a label. A labelname is required. If a label named labelname does not exist, it is created automatically. If the label already exists, you must be the Owner: of the label and the label must be unlocked in order for you to tag or untag files with the label. (Use p4 label to change label ownership or lock status.)

If the file argument does not include a revision specification, the head revision is tagged with the label. If the file argument includes a revision range specification, only files with revisions in that range are tagged. (If more than one revision of the file exists in the specified range, the highest revision in the specified range is tagged.)

Options:
-d         Delete the label tag from the named files.
-n         Display what p4 tag would do without actually performing the    operation.
-l         labelname Specify the label to be applied to file revisions
g-opts See the Global Options section.

Usage Notes
******* By default, p4 tag operates on the head revision of files in the depot. To preserve the state of a client workspace, use p4 labelsync, which operates on the revision of files last synced to your workspace.
需要注意:
默认情况下, p4 tag操作的是在depot中的文件的最新版本.如果想维持客户端工作空间的状态,则用p4 labelsync命令.这个命令操作的是你最后一次同步到本地工作空间的文件的修订版本.p4 labelsync把你工作空间的文件版本关联到那个label里边去.


Examples
p4 tag -l rel1 //depot/1.0/...
Tag the head revisions of files in //depot/1.0/... with label rel1. If the label rel1 does not exist, create it.
把//depot/1.0/...文件当前最新版本和标签rel1进行关联.如果标签rel1不存在,则创建它.
Good.这个命令就是我们常常使用的命令.记住哦.

p4 tag -l build //depot/1.0/...@1234
Tag the most recent revisions as of the submission of changelist 1234 of files in //depot/1.0/... with label rel1. If the label rel1 does not exist, create it.
在代码库//depot/1.0/...里,把changelist1234提交的文件最新修订版本和标签rel1进行关联.如果标签rel1不存在,则创建它.


p4 files @labelname
List the file revisions tagged by labelname.
列出labelname这个标签中的文件的修订版本.

原帖地址:http://bbs.scmroad.com/viewthread.php?tid=1918&extra=page%3D1

[ 本帖最后由 laofo 于 2009-3-31 17:16 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2009-04-13 13:44 |只看该作者
没怎么看明白呵呵呵
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP