我希望能夠管理我的應用程序依賴關係在Mercurial中,這樣在我的應用程序中我有一個依賴庫的叉/克隆。我希望對應用程序內的依賴關係庫進行更改並提交,但仍會從依賴關係的主庫中提取和合並更改。推送我的應用程序應該推它的依賴庫,但依賴文件不應該由應用程序庫「跟蹤」。這可能嗎?使用Mercurial管理作爲嵌套存儲庫的依賴關係
的目錄結構:
-- app
-- .hg
-- dependency
-- .hg
當我提交到應用程序庫中,這是確定的,但不是最好犯依賴庫的任何變化。
當我推送我的應用程序存儲庫時,嘗試推送依賴存儲庫是不行的。
下面的會議探討了試圖使用subrepos的isssue。該場景模擬了應用程序和lib位於託管資源庫(如Google代碼)上的場景。我也曾嘗試告訴Mercurial忽略子庫。
# Make library on Google Code
mkdir libOnGCode
cd libOnGCode/
hg init
echo "this library is really complex" > libfile
hg add
hg ci -m "I'm so awesome..."
cd ..
# Make app on Google Code
mkdir appOnGCode
cd appOnGCode/
hg init
echo "my base app" > appfile
hg add
hg ci -m "Initial app commit"
cd ..
# Bring down local copy of app
hg clone appOnGCode appLocal
cd appLocal
hg clone ../libOnGCode/ lib
# abort: path 'lib/libfile' is inside repo 'lib'
echo "I'm gonna use a library" >> appfile
hg add lib
hg add lib/*
hg ci -m "Added a library"
hg push # It's not tracking lib
echo "Trying subrepos round 1..."
echo lib = lib > .hgsub
hg add .hgsub
hg ci -m "Adding subrepo"
# committing subrepository lib
hg push
# pushing to /workingdir/appOnGCode
# pushing subrepo lib
# abort: repository /workingdir/appOnGCode/lib not found!
echo "Trying subrepos round 2..."
echo lib = ../libOnGCode > .hgsub
hg ci -m "Adding subrepo"
hg push
# Cool, the subrepo worked, pulling app pulls lib
cd lib
echo "My addition to the lib" >> libfile
hg ci -m "Adding extra functionality"
cd ..
hg push
cd ../libOnGCode
hg update
echo "Argh, it updated the lib on google code"
echo "If I didn't have permission to push on the lib repo, pushing the app would fail"
cat libfile
echo "Removing those changes"
hg backout -m "Removing those changes" tip
cd ../appLocal/lib/
hg pull -u
echo "Trying to add extra functionality again" >> libfile
hg ci -m "Trying again"
cd .hg/
echo "Removing hgrc, which only has path info"
rm hgrc
cd ../../
hg push
cd ../appOnGCode
hg update
cat lib/libfile
# Tears hair out
PS。如果任何人都可以修復格式,我會很感激。
我不認爲有可能將其克隆到Google Code中。 – 2010-06-05 21:02:31