Mercurial的"hg clone",却忽略了所有子仓库? [英] Mercurial `hg clone` but ignoring all subrepos?
问题描述
是否有一种方法可以克隆subrepos附带的存储库,而无需Mercurial提取所有subrepos?
Is there a way to clone a repo that comes with subrepos, but without having Mercurial pull all the subrepos?
看来,虽然hg clone -U
可用于获取存储库的空克隆,但没有什么能说服hg update
避免通过拉出所有子存储库而开始.
It appears that while hg clone -U
can be used to obtain an empty clone of a repo, there's nothing that would convince hg update
to avoid starting off by pulling all of the subrepos.
我应该指出,创建这样的克隆后,保持轻松同步至头部修订版本的能力至关重要.
I should point out that it is crucial to retain the ability to easily sync to the head revision after creating such a clone.
推荐答案
此答案可能超出了所需的范围,但在无法更新错误的子存储库路径或修订版本时,提供了一些有关使用Mercurial的宝贵说明.
This answer may add more than the question required, but provides some valuable notes on working with Mercurial when you can't update do to a bad subrepository path or revision.
第1步:克隆存储库而不进行任何更新
Step 1: Clone the repository without any updates
hg clone --noupdate source_repository destination_repository
第2步:使用还原获取正确的文件
Step 2: Use revert to get the right files
hg revert --all --rev revision_number --exclude subrepo_1 --exclude subrepo_2 ...
这时,您有了一个新的变更集;您可能需要确保上级修订是正确的.当我这样做时,我的新变更集的父级是变更集0.要解决此问题,我必须设置父级变更集并切换分支(因为我的变更集位于另一个分支上).
At this point, you have a new changeset; you may need to make sure the parent revision is correct. When I did this, my new changeset's parent was changeset 0. To fix this I had to set the parent changeset AND switch branches (since my changeset was on a different branch).
第3步:更改当前更改的上级
Step 3: Change the parent of the current changes
hg debugsetparents revision_number
hg branch branch_name
应该这样做.
这篇关于Mercurial的"hg clone",却忽略了所有子仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!