窯currently not support subrepos that use nested URLs on the server。這意味着,你不能有以下兩個網址的工作:
http://server/kiln/somepath/project1
http://server/kiln/somepath/project1/thirdparty
所以你應該設置窯,讓你在服務器上庫:
http://server/kiln/somepath/project1
http://server/kiln/somepath/project2
http://server/kiln/somepath/thirdparty
http://server/kiln/somepath/common
這很簡單 - 只是四個標準庫。然後克隆「項目」,創建.hgsub
文件有:
thirdparty = http://server/kiln/somepath/thirdparty
common = http://server/kiln/somepath/common
當你把那回窯,它會發現,爲subrepositories顯示鏈接。但是,子目錄不會最終被嵌套在服務器上。所以那裏不會有任何project1/thirdparty
路徑在服務器上。
這也是很不清楚,你會想要的。當你有幾個合作並使用一些通用代碼庫的項目時,你需要「project1」和「project2」來獲取對方對這個通用代碼庫的更改。所以這兩個項目中的common
subrepo推送和從http://server/kiln/somepath/common
拉動非常有用。
在Mercurial中,我們normally recommend您在.hgsub
文件中使用common = common
格式的路徑。這意味着服務器必須支持嵌套的存儲庫。當窯不支持嵌套回購時,您可以使用完整路徑。
當您最初設置子庫時,請記住您需要手動更新它們。因此,通過上述網址,您可以通過運行設置「project1」:
$ hg clone http://server/kiln/somepath/project1
$ echo "common = http://server/kiln/somepath/common" > .hgsub
$ echo "thirdparty = http://server/kiln/somepath/thirdparty" > .hgsub
$ hg commit -m "Created subrepos"
這會創建初始的空子庫。他們是空的,因爲你沒有告訴Mercurial你需要哪些變化。這在.hgsubstate
跟蹤,你會發現:
0000000000000000000000000000000000000000 common
0000000000000000000000000000000000000000 thirdparty
要填充subrepositories你做
$ cd common
$ hg pull --update
$ cd ../thirdparty
$ hg pull --update
$ cd ..
$ hg commit -m "Updated subrepos"
這將更新000...
線.hgsubstate
與兩個subrepos當前提示變更標識。未來的「project1」克隆將會注意到.hgsubstate
文件,並確保將subrepos更新爲此處提及的修訂版。
@馬丁蓋斯勒 - 感謝編輯,現在閱讀起來更容易! – unsynchronized 2012-01-14 08:51:57
沒問題,我很高興整理一下! :) – 2012-01-14 08:54:03