import的說明檔是:
Usage: cvs import [-d] [-k subst] [-I ign] [-m msg] [-b branch]
[-W spec] repository vendor-tag release-tags...
-d Use the file's modification time as the time of import.
-k sub Set default RCS keyword substitution mode.
-I ign More files to ignore (! to reset).
-b bra Vendor branch id.
-m msg Log message.
-W spec Wrappers specification line.
(Specify the --help global option for a list of other help options)
[-W spec] repository vendor-tag release-tags...
-d Use the file's modification time as the time of import.
-k sub Set default RCS keyword substitution mode.
-I ign More files to ignore (! to reset).
-b bra Vendor branch id.
-m msg Log message.
-W spec Wrappers specification line.
(Specify the --help global option for a list of other help options)
CVS 的二個重要觀念
但在 CVS 內有二個重要觀念:目錄和Tag。
因為在import時,主要是以目錄作為checkin的方式,因此,要 Checkin的檔案最好放到一個目錄內,而且直接跳到這個目錄作checkin。
至於 tag,那是因為 CVS 在 import 時會需要使用2類 tag:vendor-tag、release-tags
- Vendor Tag:提供者標記
- Release Tag:發行版本的標記
假設有個來源目錄在 123/456,我們想要將 /456的所有檔案全部 checkin 到 CVS 專案根目錄下 /456/789內,因此我們要先跳到來源目錄 /123/456 內,然後鍵入
$123> cvs import /456/789 abc def
此時,abc是指Vendor-Tag;def是指Release-Tag。
為什麼會需要Vendor-Tag呢?
在一個必須由不同開發人員和開發組來修改軟體的專案中,會從不同的地方獲得原始碼。有時候會為了區別不同開發組的原始碼,就需要在checkin檔案時直接指定Vendor-Tag。
為什麼會需要Release-Tag呢?
在一個必須由不同開發人員和開發組來修改軟體的專案中,需要對軟體開發的階段作控管,以便對程式作同步的動作,這時候會為了區別不同開發組原始碼的開發階段,就需要在checkin檔案時直接指定Release-Tag。
另外,為了應付多個 vendor 的情況,需要說明導入到哪個 vendor 分支,cvs 在import 命令中也可以指定 `-b' 選項,它的default 是1.1.1,也就是說即使不指定-b的參數,和輸入'-b 1.1.1'的結果是相同的。
例如,有2個開發組red 和 blue分別提供了目錄 /123和/456,你想:
- checkin red 組的原始碼到分支 1.1.1、使用 vendor 標籤 RED,並加入release tag RED_1-0
- checkin blue 組的原始碼到分支 1.1.1、使用 vendor 標籤 Blue,並加入release tag BLUE_1-5
就可以使用以下的指令:
$ cvs import dir RED RED_1-0
$ cvs import -b 1.1.3 dir BLUE BLUE_1-5
$ cvs import -b 1.1.3 dir BLUE BLUE_1-5
注意,如果 vendor tag 與 '-b' 選項不匹配,cvs 並不會做檢測,例如:
$ cvs import -b 1.1.3 dir RED RED_1-0
但這種不匹配已埋下了隱患,使用這種方式 cvs 可能會認為這種方式是一種錯誤。
"checkin blue 組的原始碼到分支 1.1.1、使用 vendor 標籤 Blue,並加入release tag BLUE_1-5" 跟 "cvs import -b 1.1.3 dir BLUE BLUE_1-5" 不批配吧?
回覆刪除