0

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.

commit-subs
#!/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
Tom
  • 6,325
  • 4
  • 31
  • 55
chew socks
  • 1,406
  • 2
  • 17
  • 37
  • There is actually support for narrow clones using an extension from google: https://bitbucket.org/Google/narrowhg – ngoldbaum Apr 10 '18 at 23:18
  • Hm, thanks. Downside is it only works with the most recent version(s) of mercurial (that information is buried as a comment in an open issue). I'll have to get a backport to try it because Ubuntu 16.04 is shipping with v3.7 – chew socks Apr 11 '18 at 05:37
  • 1
    Do you absolutely need to use debian packages from ubuntu? It's almost trivial to build mercurial from source and mercurial's makefile has a "make deb" target. – ngoldbaum Apr 11 '18 at 05:40
  • Oh nice, I didn't know it had a `make deb`. Strictly speaking I don't need to use a package, but I haven't updated my methods to handle custom PYTHONPATHs – chew socks Apr 11 '18 at 06:12
  • PPA with Mercurial 4.4 -> https://launchpad.net/~mercurial-ppa/+archive/ubuntu/releases – Marcos Zolnowski Apr 11 '18 at 16:48

0 Answers0