views:

117

answers:

2

Suppose I have the following (desired) folder structure:

*CommonProject
*Project#1
----> CommonProject(link)
*Project#2
----> CommonProject(link)

Where the CommonProject is the location of the source belonging to that project, and CommonProject(link) is merely a soft link to the main location. If we imagine this as a tree-view in a visual client, if I expand Project#1 I will see CommonProject there as a subdirectory, even though the files are not actually stored there.

The purpose of this is to enable the following behaviour:

When I check out Project#1 I get the files associated with that project as well as a subfolder CommonProject containing all of its files (as if Project#1 contained the copy of the files in the Version Control repository). Now if I were to modify CommonProject's files inside of Project#1 and was to submit my changes to the repository, the changes would go into the CommonProject location (no file is actually stored locally under Project#1 in the repository). Now if I was to sync Project#2, as it also contains symlink to CommonProject, it will now get my updates. Essentially the duplication of files only exists on my machine, but in the repository there is only one version of CommonProject.

I know Perforce can’t do this, without juggling 3 specs. This is very complicated and error prone, especially when a lot of people do it. Is there a source control repository out there that can do this? (a pointer to some docs on how it can be done is a plus)

Thank you.

+2  A: 

Subversion can directly store symlinks in the repository. This only works for operating systems that support symlinks though, as svn just stores the symlink the same way it would with any other file.

I think what you really want is to link to separate projects though. Subversion supports this through externals and git through submodules. Another alternative is to manage this sort of thing with in your build process, so that some static resources are gathered when you initialize the build. Generally, updating a utilities library that changes often is going to cause stability problems, so you can do this manually (or with clever scripts) when you need to

Dana the Sane
I may be reading it wrong, but it sounds like it actually puts a symlink file into the repository, so when I check out Project#1 I will get a link to CommonProject folder and not the complete copy of it under Project#1 folder (also Windows compatibility is important)
Alex K
Good point, I've updated my answer.
Dana the Sane
Excellent, externals in subversion looks like what I want (from the docs at least), I will be setting up test environment to test this.Git Submodules however are not as good. They keep original and integrated copy as 2 separate copy and require manual (or scripted) housekeeping to keep in sync (and the hole point of this is that I don't need to do extra work, and every project that uses CommonProject is automatically synced).Thank you for your answer.
Alex K
Sorin Sbarnea
A: 

You'd probably be much better off just storing the projects in a flat directory (1 directory per project, all at the same level), and using whatever you build system or IDE is to link all the stuff together.

Kibbee