Subrepos, code sharing and symlinks

Alistair Bell alistair.bell at netronome.com
Fri Sep 7 20:45:23 UTC 2012


Hi all,

We have a system right now where we use subrepos extensively. Project repos often have as many as 30 subrepos, and each subrepo can be shared by many project repos. 

The .hgsub file is of the form 'sub/sub1=../../sub/sub1' etc., which works fine in a system where there is a central repo and users push to and pull from it. 

But I now have a need to be able to push and pull between peer repos, and that means I need trivial .hgsub files (sub/sub1=sub/sub1). But I also need the code-sharing. And in fact, I would really like to be able to have the option of multiple project repos each sharing a working dir of any subrepos they share, so that I can test out any particular fix easily in multiple contexts.

No problem, one thinks -- we're using a wrapper around hg anyway, and all we do is, right after a checkout, we replace the subrepos with symlinks to where they really are.

And… of course I run into the buzzsaw called the path auditor, which wags a finger at me and says 'no can do, that's dangerous'. 

Before I hack out the 'thou shalt not traverse a symlink' audit check, is there another solution that achieves what I need? 

The requirements are:

(1) The capability to push and pull project repos arbitrarily but still share subrepos at the central repo and at any others that can accept pushes
(2) The capability for multiple project repos to share any subrepos that they share, even while checked out (including a shared working dir)

(I define 'project repo', by the way, as 'a repo that contains an .hgsub file, maybe a bit of configuration, and not much else' -- all the actual code is in subrepos.)

And yes, I'm aware of the dangers of hacking out the audit check. I've read the long thread from a few years ago. That's why I'd love to hear if there's a better solution.

Thanks!

Alistair


More information about the Mercurial mailing list