Mercurial `hg clone` but ignoring all subrepos?

后端 未结 4 1691
無奈伤痛
無奈伤痛 2021-02-04 00:37

Is there a way to clone a repo that comes with subrepos, but without having Mercurial pull all the subrepos?

It appears that while hg clone -U can be used t

4条回答
  •  忘了有多久
    2021-02-04 00:57

    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.

    Step 1: Clone the repository without any updates

    hg clone --noupdate source_repository destination_repository
    

    Step 2: Use revert to get the right files

    hg revert --all --rev revision_number --exclude subrepo_1 --exclude subrepo_2 ...
    

    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).

    Step 3: Change the parent of the current changes

    hg debugsetparents revision_number
    hg branch branch_name
    

    That should do it.

提交回复
热议问题