zoukankan      html  css  js  c++  java
  • [SCM]源码管理 perforce label实例

    一 静态label 

    静态label使用labelsync或tag来生成,实际上包含了具体的文件和版本信息。 文件必须同时包含在clientspec和label的view中,clientspec和label的view可以不相同。 

    1)server上两个depots(depot和depot2),且本地sync到最新的changelist@2

    C:\>p4 -p localhost:1666 -u aaa -c aaa_test depots
     Depot depot 2012/10/20 local depot/... 'Default depot'
     Depot depot2 2012/10/20 local depot2/... 'Created by AAA. '

    C:\>p4 -p localhost:1666 -u aaa -c aaa_test changes

     Change 2 on 2012/10/20 by AAA@AAA_Test 'second '

     Change 1 on 2012/10/20 by AAA@AAA_Test 'first ' 

     

    2)但是clientspec只包含了一个depot 

     C:\>p4 -p localhost:1666 -u aaa -c aaa_test client -o  
     Client: AAA_Test 
     Update: 2012/10/20 11:12:11 
     Access: 2012/10/20 11:21:04 
     Owner:  AAA 
     Host:   AAA-PC 
     Description:
             Created by AAA. 
     Root:   D:/p4/AAA_Test 
     Options:        noallwrite noclobber nocompress unlocked nomodtime normdir 
     SubmitOptions:  submitunchanged 
     LineEnd:        local 
     View:
             //depot/... //AAA_Test/depot/...
     

    3) 创建label1 

     C:\>p4 -p localhost:1666 -u aaa -c aaa_test label label1
     Label label1 saved.
     
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test label -o label1
     # A Perforce Label Specification.
     #
     #  Label:       The label name.
     #  Update:      The date this specification was last modified.
     #  Access:      The date of the last 'labelsync' on this label.
     #  Owner:       The user who created this label.
     #  Description: A short description of the label (optional).
     #  Options:     Label update options: [un]locked, [no]autoreload.
     #  Revision:    Optional revision specification to make an automatic label.
     #  View:        Lines to select depot files for the label.
     #
     # Use 'p4 help label' to see more about label views. 
     Label:  label1 
     Update: 2012/10/20 11:27:16 
     Access: 2012/10/20 11:27:16 
     Owner:  AAA 
     Description:
             Created by AAA. 
     Options:        unlocked noautoreload 
     View:
             //depot2/...
             //depot/...
     
     4)将本地的depot下的文件sync到label1中 (可以看到虽然label中view包含了depot2,但是由于我们本地的client中只包含depot下的文件,所以最终label1中也只有depot下的文件)
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test labelsync -l label1 //...#have
     //depot/File1.txt#1 - added
     //depot/file2.txt#1 - added
     

     C:\>p4 -p localhost:1666 -u aaa -c aaa_test files //...@label1

     //depot/File1.txt#1 - add change 1 (text)
     //depot/file2.txt#1 - add change 1 (text)
     

    5)用tag命令创建label2 (可以看到虽然label中view包含了depot2,但是由于我们本地的client中只包含depot下的文件,所以最终label2中也只有depot下的文件)

     C:\>p4 -p localhost:1666 -u aaa -c aaa_test tag -l label2 //...#have
     //depot/File1.txt#1 - added
     //depot/file2.txt#1 - added
    C:\>p4 -p localhost:1666 -u aaa -c aaa_test label -o label2
     # A Perforce Label Specification.
     #
     #  Label:       The label name.
     #  Update:      The date this specification was last modified.
     #  Access:      The date of the last 'labelsync' on this label.
     #  Owner:       The user who created this label.
     #  Description: A short description of the label (optional).
     #  Options:     Label update options: [un]locked, [no]autoreload.
     #  Revision:    Optional revision specification to make an automatic label.
     #  View:        Lines to select depot files for the label.
     #
     # Use 'p4 help label' to see more about label views. 
     Label:  label2 
     Update: 2012/10/20 11:30:43 
     Access: 2012/10/20 11:30:43 
     Owner:  AAA 
     Description:
             Created by AAA. 
     Options:        unlocked noautoreload 
     View:
             //depot2/...
             //depot/...
     
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test files //...@label2
     //depot/File1.txt#1 - add change 1 (text)
     //depot/file2.txt#1 - add change 1 (text)
     
     6)修改clientspec包含depot2
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test client
     Client AAA_Test not changed.
     
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test client -o 
     Client: AAA_Test 
     Update: 2012/10/20 11:31:47 
     Access: 2012/10/20 11:31:04 
     Owner:  AAA 
     Host:   AAA-PC 
     Description:
             Created by AAA. 
     Root:   D:/p4/AAA_Test 
     Options:        noallwrite noclobber nocompress unlocked nomodtime normdir 
     SubmitOptions:  submitunchanged 
     LineEnd:        local 
     View:
             //depot/... //AAA_Test/depot/...
             //depot2/... //AAA_Test/depot2/...
     
     7) 使用label1来sync代码
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test sync -f //...@label1
     //depot/File1.txt#1 - refreshing D:/p4/AAA_Test\depot\File1.txt

     //depot/file2.txt#1 - refreshing D:/p4/AAA_Test\depot\file2.txt 

    8)不使用label来sync代码

    C:\>p4 -p localhost:1666 -u aaa -c aaa_test sync -f //...
     //depot/File1.txt#1 - refreshing D:/p4/AAA_Test\depot\File1.txt
     //depot/file2.txt#1 - refreshing D:/p4/AAA_Test\depot\file2.txt
     //depot2/test1.txt#1 - added as D:/p4/AAA_Test\depot2\test1.txt

     //depot2/test2.txt#1 - added as D:/p4/AAA_Test\depot2\test2.txt 

    二 动态的label

    动态的label需要创建的时候指定revision来指定版本,其实内部并没有记录具体的文件,只指定了版本(手动编辑Revision:       @2字段)。不需要使用labelsync或tag来sync文件。 

    1)创建label3  (注意 Revision:@2 表示此label与changlist 2 关联)

    C:\>p4 -p localhost:1666 -u aaa -c aaa_test label label3
     Label label3 saved.
     
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test label -o label3
     # A Perforce Label Specification.
     #
     #  Label:       The label name.
     #  Update:      The date this specification was last modified.
     #  Access:      The date of the last 'labelsync' on this label.
     #  Owner:       The user who created this label.
     #  Description: A short description of the label (optional).
     #  Options:     Label update options: [un]locked, [no]autoreload.
     #  Revision:    Optional revision specification to make an automatic label.
     #  View:        Lines to select depot files for the label.
     #
     # Use 'p4 help label' to see more about label views. 
     Label:  label3 
     Update: 2012/10/20 11:46:23 
     Access: 2012/10/20 11:46:23 
     Owner:  AAA 
     Description:
             Created by AAA. 
     Options:        unlocked noautoreload 
     Revision:       @2 
     View:
             //depot2/...
             //depot/...
     

    2)当前所有的chagnelist

     C:\>p4 -p localhost:1666 -u aaa -c aaa_test changes

     Change 3 on 2012/10/20 by AAA@AAA_Test 'c '
     Change 2 on 2012/10/20 by AAA@AAA_Test 'second '
     Change 1 on 2012/10/20 by AAA@AAA_Test 'first '
     
    3)查看label3的使用 
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test files //...@label3
     //depot/File1.txt#1 - add change 1 (text)
     //depot/file2.txt#1 - add change 1 (text)
     //depot2/test1.txt#1 - add change 2 (text)
     //depot2/test2.txt#1 - add change 2 (text)
     
     C:\>p4 -p localhost:1666 -u aaa -c aaa_test sync -f //...@label3
     //depot/File1.txt#1 - refreshing D:/p4/AAA_Test\depot\File1.txt
     //depot/file2.txt#1 - refreshing D:/p4/AAA_Test\depot\file2.txt
     //depot2/test1.txt#1 - updating D:/p4/AAA_Test\depot2\test1.txt
     //depot2/test2.txt#1 - refreshing D:/p4/AAA_Test\depot2\test2.txt

      

    查看某个label中文件的最新版本: p4 changes -m 3 //...@your_label

    查看某个label中所有的文件版本:p4 files //...@your_label

    使用tag来跟新label : p4 tag -l your_label //your_depot_path/...@changelist

    使用label和labelsync来将本地client的所有文件的版本打进label: p4 label yourlable && p4 labelsync -l yourlabel //...#have 

    完!

  • 相关阅读:
    Windows 8实例教程系列 布局控制
    Windows8/Silverlight/WPF/WP7/HTML5周学习导读(1月7日1月14日)
    Silverlight动态设置WCF服务Endpoint
    轻松搭建Windows8云平台开发环境
    Windows8/Silverlight/WPF/WP7/HTML5周学习导读(1月28日2月3日)
    Windows8/Silverlight/WPF/WP7/HTML5周学习导读(1月1日1月6日)
    Qt 打印已加载可用的数据库驱动
    QSqlDatabase: QOCI driver not loaded
    QT oracle
    参数初始化列表
  • 原文地址:https://www.cnblogs.com/itech/p/2732041.html
Copyright © 2011-2022 走看看