cloning with subrepos to an ssh url

Julius Ziegler julius.ziegler at kit.edu
Thu Aug 18 08:01:44 UTC 2011


On 08/17/11 20:32, Kevin Bullock wrote:
> On Aug 17, 2011, at 8:55 AM, Julius Ziegler wrote:
>
>> Hello,
>
> Hi Julius… (replies inline below)
>> I am having problems cloning a repository containing subrepos to an ssh url. At first I thought my problem is related to this
>> http://selenic.com/pipermail/mercurial/2010-September/034737.html , but now I think that its more basic. Here is an example:
>>
...
>
> You'll note here that the subrepo is _also_ absent, which causes the error you mention below.
>
>> Having no working copy is actually the first thing that puzzles me, but this also happens if I do not have any suprepos.
>
> When you're cloning a _local_ repo to a _remote_ location, the assumption is that you're either creating a central 'canonical' repository, or making a backup copy. In either case, you don't need (nor likely want) a remote working copy.
>
> Now note that cloning and pushing don't propagate subrepos; update does, because in order to know what subrepos at what revisions should be present in the outer repo, hg has to read the .hgsub and .hgsubstate files from the _working copy_ (at a particular checked-out revision).
>
> Thus, when you clone local->remote, since the update step is skipped, the subrepos aren't cloned along with the outer repo.

Thanks for your reply Kevin, that clears it up! I was confused by the 
fact that clone _does_ propagate subrepositories when doing a local 
copy, but now I understand that this is simply because .hgsub and 
.hgsubstate are part of the working copy (and more or less, they "are" 
the subrepository), and such are cloned.

I continued searching for a workflow to achieve what I want. I actually 
_do_ want to create a canonical repository. It shall mirror the original 
subrepo structure.

Here is what I came up with (only doing local operations for the sake of 
clarity):

hg init cloned_cat
cd cloned_cat
hg init dog
echo dog=dog>.hgsub
hg add .hgsub

cd ../../original_cat
hg push ../cloned_cat
cd dog
hg push ../cloned_cat/dog

Is this really the right way? I am still surprised by the fact that when 
doing a local copy this can be done by a one-liner:

hg clone original_cat cloned_cat

Thanks and best regards,
Julius








More information about the Mercurial mailing list