cloning with subrepos to an ssh url

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Aug 17 18:32:52 UTC 2011


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:
> 
> # setup simple example repo with subrepo
> hg init dog
> cd dog
> hg init cat
> echo cat=cat > .hgsub
> hg add .hgsub
> cd cat
> echo meow > meow
> hg add meow
> cd ..
> hg commit -m"added somthing"
> 
> # try to clone this to my_server, via ssh
> cd ..
> hg -v clone dog ssh://my_server/repos/dog
> 
> running ssh my_server "hg init repos/dog"
> running ssh my_server "hg -R repos/dog serve --stdio"
> searching for changes
> 1 changesets found
> remote: adding changesets
> remote: adding manifests
> remote: adding file changes
> remote: added 1 changesets with 2 changes to 2 files
> 
> If I now ssh to my_server, the directory repos/dog is there,
> but it has no working copy:
> 
> find repos/dog
> 
> repos/dog/
> repos/dog/.hg
> repos/dog/.hg/branchheads.cache
> repos/dog/.hg/00changelog.i
> repos/dog/.hg/undo.desc
> repos/dog/.hg/undo.dirstate
> repos/dog/.hg/store
> repos/dog/.hg/store/undo
> repos/dog/.hg/store/data
> repos/dog/.hg/store/data/.hgsubstate.i
> repos/dog/.hg/store/data/.hgsub.i
> repos/dog/.hg/store/fncache
> repos/dog/.hg/store/00changelog.i
> repos/dog/.hg/store/00manifest.i
> repos/dog/.hg/undo.branch
> repos/dog/.hg/requires

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.

pacem in terris / mir / shanti / salaam / heiwa
Kevin R. Bullock
> In that case, however, I can restore the working copy by hg update. But in the case with a subrepo, this gives me:
> 
> cd repos/dog
> hg up
> 
> pulling subrepo cat from /home/ziegler/repos/dog/cat
> no changes found
> abort: unknown revision '14aad4f7de9a6a86b282b5de60279e154da63079'!
> 
> I am really clueless! Why is this not working?
> 
> Thanks!
> 
> Julius




More information about the Mercurial mailing list