I was really surprised how long it took me to find out how to do this – as it’s quite a simple operation, but if your deployment folder structure matches your SVN repository (e.g. classic ASP site, PHP etc) and you want to do a partial deployment of only files changed in a particular revision (or revisions) then here’s how to get the files (complete with folder structure) using TortoiseSVN:
- First you need to work out how you’re going to identify your revision range. There’s a number of ways to go about this:
- Version comments are your friend
- You could just note the revision number when you commit.
- You could use tags to help identify the range. I use CruiseControl.NET and so all ‘builds’ are automatically tagged. If you always release from tags then you can just ‘show log’ on the tag and see the max revision number.
- You could just use a date range.
- Once you’ve decided ‘how’ you’re going to identify the revisions (it may be as simple as the ‘last commit’) then either through your working copy, or from Repo Browser ‘show log’ on the root of your ‘deployment’ folder structure. The files you’re interested in may be within a ‘code’ or ‘source’ folder or similar so you only want to get the files you want to deploy.
- Select the revision/s based on the method you’re using (step 1) and do ‘Compare revisions’. If you’re just looking at one revision then do ‘Compare with previous revision’.
- Review the list of files and select all (assuming the list looks correct) then right-click and ‘Export selection to…’
- The file structure will be created at the folder you specify, and you can then zip or do whatever you normally do to deploy.
If you only want the list of files then you can choose ‘Save list of selected files to…’ (text file).
This is all cool and simple, but it’s still quite a manual process. If you’re certain of the revisions or you automatically keep track of the last deployment revision then it would probably make sense to automate this further with something like NAnt (which is what I’ll attempt to eventually get round to).
This process also doesn’t cater for deletions (as such), so special care needs to be taken when reviewing the list of files (the action column shows the nature of the changes).