Subrepos, code sharing and symlinks

50 views
Skip to first unread message

Alistair Bell

unread,
Sep 7, 2012, 4:45:23 PM9/7/12
to merc...@selenic.com
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
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial

Mads Kiilerich

unread,
Sep 9, 2012, 5:51:48 PM9/9/12
to Alistair Bell, merc...@selenic.com
Alistair Bell wrote, On 09/07/2012 10:45 PM:
> Hi all,
>
> We have a system right now where we use subrepos extensively.

[snipping requirements that conflict with subrepos]

> That's why I'd love to hear if there's a better solution.

With subrepos what you see is what you get. If you really want something
else (and you probably do) then you are better off not using subrepos.

The best solution is probably to do the necessary plumbing in your build
scripts or in your Mercurial wrapper.

https://bitbucket.org/hstuart/repoman might be useful as a starting
point or for inspiration.

/Mads

Todd Greer

unread,
Sep 11, 2012, 12:58:27 PM9/11/12
to Alistair Bell, merc...@selenic.com
You may wish to try the GuestRepo extension at https://bitbucket.org/selinc/guestrepo/. It might fit your needs better than subrepos.

--
Todd Greer

-----Original Message-----
From: mercuria...@selenic.com [mailto:mercuria...@selenic.com] On Behalf Of Alistair Bell
Sent: Friday, September 07, 2012 3:45 PM
To: merc...@selenic.com
Subject: Subrepos, code sharing and symlinks

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'.
Reply all
Reply to author
Forward
0 new messages