Subrepositories location

Mads Kiilerich mads at kiilerich.com
Thu May 19 14:52:14 UTC 2011


On 05/19/2011 04:03 PM, J.S. van Bethlehem wrote:
> Hello hg-people,
>
> Let me first say how happy I am with HG. I've been using basic HG for
> quite some while now and it suits all my needs.
> So today I started experimenting a bit with the subrepo feature. And I
> have the following question:
> is the location of a subrepo in some limited?
>
> I have the following in my .hgsub file:
> bool = ../bool

That means that you within your repository (next to .hgsub) have a bool 
directory (the left hand side) which actually is a hg repository 
(bool/.hg already exists). When you push and pull the subrepository it 
will happen to an url with the path ../bool (the right hand side) 
relative to the location of where the top level goes.

I recommend that subrepositories always are used with trivial mappings 
such as "bool = bool".

> It's kind of weird, I know, but that's the way it is. So I have some
> repository that should become the subrepo that is at the same level as
> the current repo.

So it is a "next to repository"? Then it is not a subrepository.

If you really need these two repositories next to each other then I 
suggest you create a new top level repository that has these two 
repositories as immediate subrepositories.

> Now when I did hg ci, indeed I got a message that it
> was first comitting ../bool before comitting the current repo.

I doubt that.

> Yet, when
> going to ../bool I saw that nothing had happened! So: is there some
> limitation on the type of relative paths that is accepted as subrepo?
> (eg: any subrepo for which the path starts with ../ is simply not allowed?)

It is not so much a limitation but rather a definition: subrepositories 
are repositories in a directory below the top level repository which 
references it in .hgsub. That ensures both security and simplicity and 
that subrepos are managable.

See also http://mercurial.selenic.com/wiki/Subrepository .

/Mads



More information about the Mercurial mailing list