tags:

views:

51

answers:

1

If you had a SVN repo set up for a script, like a shopping cart, how would you handle a site that will use the cart, but contain custom features as well? You need source control on the custom parts, so you add a new repo. Do you copy the script repo to the site-specific one? If you do and bug fixes are applied to the script, you would also have to apply them to this project. Would it be better to have a custom build script that gets code from 2 locations? That would only work if the code being modified isn't part of the first repo.

+3  A: 

For this I would use an external. This is really what it's for.

Excerpt:

Sometimes it is useful to construct a working copy that is made out of a number of different checkouts. For example, you may want different subdirectories to come from different locations in a repository, or perhaps from different repositories altogether.

Fortunately, Subversion provides support for externals definitions. An externals definition is a mapping of a local directory to the URL—and possibly a particular revision—of a versioned resource. In Subversion, you declare externals definitions in groups using the svn:externals property.

In your case, you will have the cart project as an external to the custom project.

MPelletier
Would changing the log in method on the cart to work with the custom features get checked back in to the original location?
SJaguar13
This is where you have to arrange your projects to support this. As I understand it your cart is your common project. Think of this as a function library or a dll of some kind. It's used by your customisation, but also potentially other projects. Your cart library will have the basics, and your custom project will have its specifics (i.e. customisations). If you modify something in your cart project, it has to be general, it has to serve all other projects. Once you have this set up, your custom project will have inside the cart project, and modification to the cart can be committed from there
MPelletier
What if you are overriding something? The original needs to stay, but the project needs the modified version.
SJaguar13
That's highly dependant on your platform at that point. An external is a pointer to another project (or part of another or same project) to make it look like it only belongs to your current one. If you commit changes on the external, it changes the project at the other end of `svn:external`. Several languages will have a way to override functions and inherit classes that will work well with this, but admittedly not all.
MPelletier