0

I have a shell repository OriginalWithSubrepo with a subrepository Sub containing a bunch of actual files.

When I clone OriginalWithSubrepo like this

hg clone --pull --noupdate "C:\TestRepo\OriginalWithSubrepo" "C:\TestRepo\OriginalWithSubrepo-clone"

The clone thus created contains just a few mercurial housekeeping files, there is no actual data from the original Sub\.hg directory. I don't know what those files mean but apparently they are enough to recreate the repo because when I update the working directory in clone, the whole thing gets filled out with all the files, including inside the Sub\.hg directory. However, if I clone, then rename the original, and then attempt to update the clone, it doesn't work saying the OriginalWithSubrepo is not found, which means it's all based on links to the original.

This problem doesn't arise when I run clone with update, or when I clone a repository without subrepos.

It behaves the same when I clone to a network share, which is where I really want it to work.

So how do I make a fully independent clone of a repo with subrepos (w/o a simultaneous update)?

Windows XP, hg version 3.4.1

Igor Ivanov
  • 37
  • 1
  • 6

1 Answers1

0

When you add the first subrepo to the parent repo, .hgsub is added to the parent repo. The subrepo only becomes a subrepo from the changeset that commits .hgsub.

When you do hg clone --noupdate --pull parent parent-clone, parent-clone is not at any changeset yet, and so not yet at a changeset at which the subrepo has been created

So how do I make a fully independent clone of a repo with subrepos (w/o a simultaneous update)?

I don't think you can do this as such.

But this may achieve what you're trying to do (I'm reading between the lines here, but I'm guessing to have the repo on the share, but without any files visible):

  1. Create repos on your network share for your parent and sub \\fileserver\repos\OriginalWithSub\ and \\fileserver\repos\Sub\
  2. Modify your local OriginalWithSub .hgsub set the remote path to be \\fileserver\repos\Sub\ and commit.
  3. push your local repositories to their respective network share equivalents.

Both repositories now exist on the network share, without any files visible apart from inside .hg, and you can clone \\fileserver\repos\OriginalWithSub\ (with update) from another computer and get the full history of both OriginalWithSub and Sub.

Sigve Kolbeinson
  • 1,133
  • 1
  • 7
  • 16