views:

240

answers:

6

I want to use Subversion with a script based development system, and was wondering what to do differently to my usual situation (C#/.NET).

The normal day-to-day update/commit cycle will work fine, as will change tracking and comparison of revisions. Where I'd like some advice is around handling of deployment.

With this script system, there's no distinct build step involved - instead, deployment involves uploading a selected script directly into the host application.

Changes to a script aren't necessarily included in the next release - they may be destined for the release after that, or the one after that.

In an ideal world, I'd like to be able to allocate a script into a given release, say the "September 2009" release, once it's been tested, and then pull out all the scripts for that release with a single command.

Update

As far as I can tell, neither Tags nor ChangeLists are going to be the answer.

ChangeLists aren't persistent (don't exist in the repository) and I need a solution that will allow review much later on.

Tags are effectively the same as branches - they contain all files by default, and you just get to choose which revisions.

I'm hoping for an approach that would start off with an empty branch into which specific file revisions could be placed as required.

Update 2

Two examples, showing how I can meet this situation with featues in other tools. Note that I'm not trying to promote these tools at all, as I want to use subversion, I'm just trying to work out how.

With QVCS, I can achieve my desired result by applying a label to a specific revision of a file. That label would stay in place, attached to that revision of that file. At any time, I could do a clean checkout, into an empty directory, and specify that only files with the specified label should be copied down.

Similarly, with StarTeam, I can apply a label to a file revision and check out only files with that label.

+4  A: 

"In an ideal world, I'd like to be able to allocate a script into a given release, say the "September 2009" release, once it's been tested, and then pull out all the scripts for that release with a single command."

This is exactly what tags are designed for.

Amber
tags are meant to be a "friendly name" for a specific revision. it only works in this case if the op is looking for a nice way to identify which revision in which the script was added.
Nader Shirazie
Read the "Creating a Complex Tag" section of the article linked to in my answer, nader.
Amber
+1 Yes, this is a great example of where to use complex tags. Using changelists when doing this may prove convenient as well. http://svnbook.red-bean.com/en/1.5/svn.advanced.changelists.html
Dan McGrath
Tags (and Branches) seem to include *all* files (see my update in the question).
Bevan
See my comment on your actual question - you can create an empty tag/branch via `svn mkdir` and then only svn copy in the items which you actually desire to be present - tags and branches in Subversion act just like any other directory in the repository, they just happen to be in a special place.
Amber
@Dav - Cheers, I learned something from that. While a tag is still essentially a way of identifying a particular snapshot of the repository -- its much more flexible than I thought.
Nader Shirazie
+5  A: 

You can manage your "future" releases with Subversion branches. When you make a change that is destined for a future release, commit it to the appropriate branch. When the time comes to pull all those future features into the trunk, merge the branch.

This isn't really all that different from the workflow for using Subversion with a compiled language, or indeed for any other purpose.

See the Common Branching Patterns section of the Subversion book for more information. In particular, the "Feature Branches" section sounds most appropriate to your situation.

Greg Hewgill
The problem with a branch is that it contains *every* file. This makes perfect sense for a compiled system (since you have to have everything to compile), but is exactly what I *don't want* in this case, as I only want specific nominated (tested) files to be included.
Bevan
I don't understand why you would need to treat compiled systems differently from any other collection of files. A feature branch contains a view of your entire system, but some files may be updated as compared to the trunk. When you merge the feature branch back into the trunk, nothing will happen to those files that have not been changed in the feature branch. In particular, even if some files have been updated later in the trunk, a merge of the feature branch without changes to those files will succeed without error. This is generally exactly what you want.
Greg Hewgill
Subversion implements "cheap copies", so tagging and branching take almost no time and almost no extra space for the copy that is visible in the tag/branch, no matter how many files or how much storage is involved. You can make a branch containing ten thousand full-resolution desktop background images in the same amount of time it would take to branch a project containing a single Perl script.
Greg Hewgill
@Greg Hewgill - the key difference in my scenario is that my deployment package should *only* contain files (scripts) that have changed, and that have been deliberately selected for a specific release. Files that are unchanged, and modified files that are not a part of this release, must not be included in the deployment package. A typical deployment package might contain just 20 scripts.
Bevan
@Greg Hewgill - it's useful to know that cost/time for creating a branch is constant, reguardless of the number of files, thanks. However, the overhead in SVN was never my motivation for the approach.
Bevan
It sounds like one approach (option A) would be to branch everything as I've described, and then at delivery time, run a diff between the branch and its branch point from the trunk to see what has changed. You can create a script to take this diff and create a delivery package with only the items that have changed. Option B would be to create an empty directory somewhere in Subversion using mkdir (as somebody else suggested) and just put new files in there. The benefit of option A is that it maintains the history of the branch and which trunk revision the new scripts are based on.
Greg Hewgill
+4  A: 

One solution would be to start of a new branch using svn mkdir (instead of svn copy), and then selectively copying the files needed from your main branch by way of svn copy

Anders Johannsen
This might be what I need - I'll try it out.
Bevan
You can also use the `--summarize` option of `svn diff` to easily identify your changed files.
Stephen Denne
+1  A: 

I believe that with svn 1.6 you can have externals pointing to individual files. So, if you want, you can create an empty tree structure and define a set of externals on it which bring in the files you want into the structure. This would give you a kind of 'live view' of a branch.

You could perhaps reference the file versions directly from the trunk - or you could layer your approach and use a release branch to merge in particular revisions, and then reference that release branch in the externals of your 'live view'. That way, you release features by merging revisions - keeping normal revision control and merge history, and then an svn-update on the server would pull those files into the live structure.

The downside would be that it would be difficult to switch to a diffrerent branch (say an old tag, because of a problem in the new release) - you'd have to manually edit all your externals definitions. This may not be a problem if they're all on the same directory, but could be a pain if you have to hunt around for them.

A little information on file externals are available in the svn 1.6 release notes

Jim T
+1  A: 

I see the problem - which has nothing to do with SVN. You want to store some files in a release branch, but not others. So either branch the entire release directory and then delete the files you do not want to show in there; or create a new empty directory and copy just the files you do want.

Its is that simple. You don't need changelists or tags or anything complicated at all, and no subversion system will be able to guess which files you do want. Personally, I'd do the branch+delete option as then you can undo the deletion at a later date if you decide you do want the files back.

gbjbaanb
A: 

It sounds like you are looking for metadata about specific scripts. Thus one option is to store your scripts as separate files, and use svn properties. Svn properties allow you to store key-value pairs associated with a file.

For example, to mirror your "label" example, you could create a property for each file you decide to include in a particular release. In this case, create a "September 2009" property with value "true".

You can then select only the files with the "September 2009" property when generating your deployment package.

Using tags and branches are useful when you want to track the changes to your repository over time, and to generate diffs to see what those changes are -- but it is a snapshot of the entire repository...

Nader Shirazie