using subrepos without a central server

Wagner Bruna wagner.bruna+mercurial at gmail.com
Tue Aug 3 14:25:54 UTC 2010


Andrew Petersen wrote:
> We've got a central server, and several repos (projects) that reference
> many shared subrepos (shared libraries). The .hgsub file has absolute
> urls for all the subrepos. This works fine enough, but we recently
> discovered a problem. It's nearly impossible to pull directly from
> another person when dealing with subrepos. Let's say we have two people,
> Joe and Sally. Joe has changes committed in one of his subrepos that are
> not pushed to the central server yet. Sally wants those changes. So Joe
> does 'hg serve' on the parent repo, and Sally pulls from that. However,
> all she will get from him is changes made to the parent (which in my
> case, will be basically nothing, since all that's in the parent repo is
> .hgsub and a VS solution file). When her clone tries to pull the
> subrepos, it will use the paths defined in the .hgsub file, and not
> those from Joe. 
> 
> Even worse, if the central server is down, it's impossible to run
> commands on the parent repo, as all the subs have to hit the central server!
> 
> It makes sense why this fails given the way I've set the projects up and
> understand subrepos to work. The question is, is there a way to setup
> subrepos so that they act more like a whole project when pulling changes
> from other people?

We use relative paths for all our subrepos:

~/repo $ cat .hgsub
subrepo1 = subrepo1
path/subrepo2 = path/subrepo2

This way, all clones replicate exactly the same structure, so we're able to sync
directly between them.

On the server, the subrepos are actually symlinks to their real location, increasing
the administration burden a bit. But there's ongoing work to improve this:

http://www.selenic.com/pipermail/mercurial-devel/2010-July/022957.html
http://www.selenic.com/pipermail/mercurial-devel/2010-July/023058.html

> In the above example, Joe could have served only his
> subrepo, and Sally could have pulled from that into her clone of the
> subrepo. But that would be very tedious if there were changes in more
> than one subrepo.
> 
> Basically, I'm asking if there is a better way to structure our projects
> so that we can easily pull from each other, without relying on the
> central server, AND while using subrepos, since we have a LOT of shared
> code between projects. If someone has an alternative to subrepos, I'd
> love to hear that too!

There's an alternative for sharing code that may be more suited to your workflow:

http://www.selenic.com/pipermail/mercurial/2010-June/033300.html

Regards,
Wagner

> 
> Yip yip,
> ~ Drew*
> 




More information about the Mercurial mailing list