3

I have a project I'm currently working on, which I am contemplating making open source, but I definitely want to keep it closed-source for the time being. Inside this project, I have a sort of subproject that I want to make public, so anyone can access/fork it.

So here's what I want:

A mercurial SCC with:

  • Repo 1: All files from /dir/project/ - Private repo, requires username/password to pull/push/fork/browse etc.
  • Repo 2: Some files from /dir/project/stuff - Public repo, but requires username/password to modify.

How can I do this? Is there a better way I can do this? I'm using my shared hosting Linux environment to do this, so is symbolic linking a better idea?

I'm open to all suggestions thanks, still a bit of a HG newbie.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Liam Dawson
  • 1,189
  • 13
  • 27

1 Answers1

2

You should use "subrepository" to define the two parts of your project:

  • your parent repo would be the private one, with a reference (in a .hgsub file) to your public repo ()
  • your public repo woud be stored in a public referential, with no knowledge of the private part.

(No symlink necessary here)
See also in the same kind of problem the SO question "Mercurial Subrepos - How do you create them and how do they work?".

Subrepositories is a feature that allows you to treat a collection of repositories as a group. This will allow you to clone, commit to, push, and pull projects and their associated libraries as a group.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Sounds like what I'm after. Thanks, will try it. – Liam Dawson Dec 24 '10 at 11:26
  • @VonC Not quite following, sorry. Where would I make each repository? Keep in mind, I could very easily want to share 2 repos from /dir/project/stuff, because I'd have two different 'plugins' in there. Would I be better off creating a /dir/plugins/plugin1 repo with the files there, and have it update in the main repo when I commit there? Is that what you are saying? The documentation on subrepos is a bit confuzzling... – Liam Dawson Dec 25 '10 at 08:13
  • @dawmail333: http://stackoverflow.com/questions/2083393/mercurial-subrepos-how-do-you-create-them-and-how-do-they-work is more detailed, but the idea remains to create as many subrepo you need within a parent repository (like `/dir/project` in your case) – VonC Dec 25 '10 at 09:51
  • Herp a derp, I just realised that I don't have to make a repo directly in the referenced directory... I can easily make a repo off in /dir2/stuff that claims the files in /dir/project/stuff, right? – Liam Dawson Dec 25 '10 at 10:37
  • @dawmail333: yes, a subrepo is a reference from any other remote repo, that you will checkout within a parent repo (hence the notion of nested repos) – VonC Dec 25 '10 at 11:32
  • @VonC I think I need to go back over hg, must have missed some of the basics. – Liam Dawson Dec 25 '10 at 12:08
  • Perhaps making a repo with multiple branches would be a smarter idea. – Liam Dawson Dec 25 '10 at 12:09
  • @VonC, I changed my system, so I made a new question: http://stackoverflow.com/questions/4539449/importing-a-mercurial-repository-automatically-e-g-svn-externals – Liam Dawson Dec 27 '10 at 14:51
  • I still marked your answer though, because if that were exactly what I were after, it would work. My fundamental misunderstandings of HG caused me to ask the wrong question. – Liam Dawson Dec 27 '10 at 14:52