I would like to keep a collection of mercurial subprepositories updates at tip
and this is what I've come up with. Are there any gotchas I'm not seeing if I do it this way?
Backstory
For many years now I have been using monolithic subversion repository main
but I am getting ready to convert it over to mercurial. The only thing I don't like about mercurial is that I can't clone just one subdirectory. I was thinking of making each top level directory of main
into its own mercurial repository. Then I could create one mercurial repo called maincollections
that would reference each new mercurial repo as a subrepo. In order to get changes to any subrepo by just pulling once inside maincollections
I set up the following.
Method
When a push is received on the server in any one of the subrepos it triggers the changegroup
hook commit-sub
to force an update and commit of .hgsubstate
in the maincollections
repo.
#!/bin/bash
SUBNAME=$(basename $(pwd))
cd ../../maincollection/$SUBNAME
hg pull
hg up
cd ..
hg ci -m "Automated update of .hgsubstate"
Directory organization
maincollection # repo with subrepos
main/* # Individual subrepos