[SCM]源碼管理 -perforce label執行個體

來源:互聯網
上載者:User

 

一 靜態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來指定版本,其實內部並沒有記錄具體的檔案,只指定了版本。不需要使用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

  

完!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.