1
votes

We have several shared libraries that exist as subrepos in a parent repo. If a person clones the parent repo, it looks something like:

/ParentRepo
---- .hg
---- .hgsub
---- .hgsubstate
---- SharedSub1
---- SharedSub2
---- SharedSub3
---- SharedSub4
---- ParentRepo.sln

.hgsub looks like this:

SharedSub1 = http://ourfogbugz.us.com/..../SharedSub1
SharedSub2 = http://ourfogbugz.us.com/..../SharedSub2
SharedSub3 = http://ourfogbugz.us.com/..../SharedSub3
SharedSub4 = http://ourfogbugz.us.com/..../SharedSub4

Each subrepo's hgrc looks something like this:

default = http://ourfogbugz.us.com/..../SharedSub1

Pretty standard stuff.

But!

How, using this setup, does a co-worker pull from another without using a central server as the intermediary? So co-worker A does 'hg serve', and B does 'hg pull http://coworkerA.us.com:8000'... but this will fail, as the hgsub file is still pointing at the central server, and thus B will only get changes from the central server, and not get any changes from A's subrepos that do not exist on the central server.

This is further complicated if the central server is down or unreachable. There is no way for people to pull from each other directly using subrepos!

How is pulling between co-workers done using subrepos? Editing the hgrc and hgsub files is out of the question, because you'd have to do it for each subrepo (we have around 20), and once for each co-worker!

I have also posted this question on the Kiln StackExchange to hit a broader audience: http://kiln.stackexchange.com/questions/1780/pulling-from-a-co-worker-when-using-subrepositories

1

1 Answers

2
votes

You can (and generally should) use relative paths in your .hgsub entires. If those lines were:

SharedSub1 = ../SharedSub1
SharedSub2 = ../SharedSub2
SharedSub3 = ../SharedSub3
SharedSub4 = ../SharedSub4

then you could clone from central, from a friend, or a local clone on your own.