Mercurial / Hg SubRepos

Mercurial / Hg SubRepos

I’m still trying to catch up on stuff following Develop. I’ve decided to write a post about my experience(s) switching my work over to SubRepos.

I am unaware of the “reason” why they’re considered “bad.” Perhaps it’s a Unix thing? Maybe they don’t work as well as people feel that they should?

Whatever

I have a (secret) project called “nite-nite/” in which I use and develop some public-domain headers. I want this public-domain stuff to be … well … public-domain and visible to all. Putting these into a Sub-Repository seemed appropriate, so I started by setting up a separate repository on BitBucket. Following the basic usage I cloned this into my existing working copy and set it up as directed;

C:\Users\peter\Desktop\nite-nite>hg clone ssh://hg@bitbucket.org/g-pechorin/pal-public-domain
C:\Users\peter\Desktop\nite-nite>echo pal-public-domain = pal-public-domain > .hgsub
C:\Users\peter\Desktop\nite-nite>hg add .hgsub

So far so good right? Well … not so much. The push command won’t work right with the setup we/I just used.

The fix is simple, the file .hgsub looks like this …

pal-public-domain = pal-public-domain

… and it needs to look like this …

pal-public-domain = ssh://hg@bitbucket.org/g-pechorin/pal-public-domain

So commit/amend the previous commit and push

C:\Users\peter\Desktop\nite-nite>hg commit -m "added public domain stuff"
C:\Users\peter\Desktop\nite-nite>hg push

I’m reasonably happy with this. As a bonus, I applied it to my blog and the embedded Unity project can be embedded as the source rather than a binary. Great, now I’ll get on with the actual work of moving those headers into the public-domain project.

Peter LaValle avatar
About Peter LaValle
Peter is currently a PhD student at the University of Nottingham. His day work involves applying functional programming to problems with artificial intelligence. Someday maybe he'll retire and be a graphics programmer or demoscene coder.
comments powered by Disqus