有没有办法克隆subrepos附带的repo,但没有Mercurial拉出所有subrepos?
似乎虽然hg clone -U可以用来获得一个repo的空克隆,但是没有任何东西可以说服hg update避免通过拉动所有的subrepos来开始.
我应该指出,在创建这样的克隆之后,保留轻松同步到头版本的能力至关重要.
小智 13
这应该做你想要的:
REM Take a new clone, but do not update working directory
hg clone --noupdate %REPO_PATH% %DESTINATION%
REM Update working directory but exclude the certain subprojects
hg revert --all --rev %BRANCH% --exclude %SUBREPO_PATH_1% --exclude %SUBREPO_PATH_2%
Run Code Online (Sandbox Code Playgroud)
这个答案可能会增加所需的问题,但是当您无法更新do到不良的子存储库路径或修订时,会提供一些有关使用Mercurial的有价值的说明.
第1步:在没有任何更新的情况下克隆存储库
hg clone --noupdate source_repository destination_repository
Run Code Online (Sandbox Code Playgroud)
第2步:使用revert获取正确的文件
hg revert --all --rev revision_number --exclude subrepo_1 --exclude subrepo_2 ...
Run Code Online (Sandbox Code Playgroud)
此时,您有一个新的变更集; 您可能需要确保父修订版是正确的.当我这样做时,我的新变更集的父级是变更集0.为了解决这个问题,我必须设置父变更集AND切换分支(因为我的变更集在不同的分支上).
第3步:更改当前更改的父级
hg debugsetparents revision_number
hg branch branch_name
Run Code Online (Sandbox Code Playgroud)
应该这样做.
找到了一种骇人听闻的方法。仍然需要将所有子仓库检出一次,但是之后可以将其删除。
hg remove .hgsub我试图说服Mercurial hg remove .hgsub在克隆子仓库之前,但是我得到的最好的结果是not removing .hgsub: file is untracked。