Question

I am working with a Mercurial repository that has the following structure:

  -- Root
     -- .hgsub
     -- SubDir
        -- SubSubDir
        -- SubRepo

The .hgsub file declares SubRepo as follows:

    SubDir/SubRepo = ssh://server//subcomponent

I needed to get rid of the subrepo and replace it with an actual folder in the repo called SubRepo, so I did what the hg documentation said, removing the .hgsub file and committing. Then I put my own stuff in SubRepo and committed it, leaving me with:

  -- Root
     -- SubDir
        -- SubSubDir
        -- SubRepo

Dandy. But when I try to, say, pull changes from a repository that still has its .hgsub file, I run into trouble.

Is there a better way to replace a subrepository? Or is there something clever I should do to make this work better, like using an option to pull or temporarily changing my .hgsub to point to a new folder rather than removing it altogether?

Was it helpful?

Solution

You've done it right. Once you pull from the repos that still have .hgsub you'll need to merge your head (that doesn't have .hgsub) with theirs (that does), and when you remove the file as part of that merge/commit you'll end up with only one head that has no .hgsub and all will be right in the world. As long as you don't 'hg update' to their remote head that still has .hgsub you should be fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top