自動對perforce上的changelist description 加上額外的資訊(有用的)

來源:互聯網
上載者:User

最近在做Automation, 對perforce這樣的版本控制軟體的自動化, 有這樣的一個小功能,就是自動修改changelist description.在

description裡加上自己感興趣的資訊: 比如code 的版本資訊, 還有changelist 從哪裡tryout出來的資訊等等.

本來以為強大的perforce提供有這樣的command,用一下就行了.可是不是那麼簡單.

從網上看到perforce這方面的介紹:

 http://www.perforce.com/perforce/r12.1/manuals/cmdref/change.html#1040665

p4 [g-opts]
change -i [ -s ] [ -f | -u ]

就是有個 -i 的參數, 可以完成對description的改動.

咱們來看看perforce的介紹吧:

-i Read a changelist description from standard input. Input must be in the same format by the p4 change form.這裡standard out 可以是個檔案, 而p4 change form是什麼呢?原來這個form是在上面的Form Field定義:Change: 當前的changelist number ,如果是建立changelist, 就寫成new.Client:  當前的client nameDescription: 描述當前changelist 的資訊.........(還有許多)看來要把這些都寫清楚, 才好改變我的description. 如果我漏掉一項,或者某項寫錯,那麼我這個changelist就會改變.我曾偷懶的這些了前面列的三項,結果執行的時候, 我的changelist上的檔案全部給remove掉了(跑道default changelist裡了).而把這些全部寫清楚是很痛苦的.幸好perforce 提供了另外一個 -o 參數, 可以把當前changelist裡的資訊按照form寫到一個檔案裡.我就只需要去這個檔案裡對description 進行修改就行了, 然後再用-i 參數把這個檔案再輸進到這個changelist裡.output_changelist_description_command = "p4 -c " + @clientname + " change -o > #{filename} #{changelistId}"fix_changelist_description_command = "p4 -c " + @clientname + " change -i < #{filename}"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.