Mercurial`hg clone`但忽略了所有subrepos?

Rom*_*kov 22 mercurial

有没有办法克隆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)


Rob*_*man 8

这个答案可能会增加所需的问题,但是当您无法更新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)

应该这样做.

  • 在步骤3之后,`hg status`仍然显示所有文件为待处理添加.运行`hg debugrebuildstate -r tip`修复了这个问题. (2认同)

Rom*_*kov 5

找到了一种骇人听闻的方法。仍然需要将所有子仓库检出一次,但是之后可以将其删除。

  1. 克隆整个文件,包括子仓库。没办法解决。
  2. 删除子仓库
  3. hg remove .hgsub

我试图说服Mercurial hg remove .hgsub在克隆子仓库之前,但是我得到的最好的结果是not removing .hgsub: file is untracked

  • 真可惜 (6认同)
  • 如果由于某种原因无法访问您的外部子存储库,则此解决方案确实无济于事。关于忽略子仓库的一些讨论[here](http://mercurial.selenic.com/bts/issue2520)。 (6认同)