Using TortoiseSVN to Export Only New/Modified Files
- September 6th, 2007
- Posted in Announcements . SVN
- Write comment
Though many teams are using Subversion (SVN) to work together and share code, version control software provides a huge number of features that are not often used. Just about any developer these days knows how to checkout a project and commit or revert changes. But a lot of teams don’t really use more advanced features like branching and tagging to organize releases.
The great thing about version control systems like SVN is that you gain a bunch of really useful functionality – even if you have only been using it for sharing code. One of those features is the ability to create an export of all modified files since the previous release. A common scenario is when the team is working on a web application and it’s time to deploy all the recent changes to the production server. An app that is distributed would normally use tags or branches to keep the versions straight. But some teams prefer to just keep moving forward on the HEAD revision and never look back. If this sounds like you, luckily SVN provides an easy way to get all changed files since your last deployment and package them up with just a few clicks.
Lets say that you last deployed your application from repository version #500. After a few weeks of development, the repository is now up to revision #575. The team has decided that the code is stable and you are ready to package up all new/changed files to transfer to the host server, client, etc.
1. Using TortoiseSVN, right-click on your working folder and select “Show Log” from the TortoiseSVN menu.
2. Click the revision that was last published (#500 in this example)
3. Ctrl+Click the HEAD revision (or whatever revision you want to release ie #575) so that both the old and the new revisions are highlighted.
4. Right-click on either of the highlighted revisions and select “Compare revisions.” This will open a dialog window that lists all new/modified files.
5. Select all files from this list (Ctrl+a) then right-click on the highlighted files and select “Export selection to…”
You’ll be prompted for a location to save your updated files and SVN will export them all with the directory structure preserved. You can then zip this up for your client, transfer it to your host or whatever you normally do to deploy the application.
Some teams prefer to actually do an update right on the production server and simply checkout the files that way. If your hosting setup permits and you don’t mind the “.svn” files in on your server, that is another easy option for deploying code.
For even more automation, this could all be done using batch, shell or ant build scripts. If you have such a script, please feel free to post it in the comments.
Thanks for the post, this would appear to be exactly what I need, but I have yet to get it to work.
The TortoiseSVN windows client does not allow the export of files, only directories.
How did you get around this? What version of SVN client are you using?
Hey Brett, I usually upgrade TortoiseSVN about every few months or whatever, but I’m not running any bleeding edge beta code or anything – I think the export features have been there for a while.
As far as the export goes – this method exports anything that has changed between revisions and it preserves the directory structure. So you have the whole folder.
If you just want the files w/o any directory structure, I’m not sure the reason you would want that, but one trick that I use in windows to “flatten” a directory structure is just use windows explorer search function to search within the folder for “*.*”. Search will return a list of all files which then you can copy the results to a single folder.
I was doing this in Win XP and it was great. Does anyone know of a SVN client that can do the similar in Linux (eg. Ubuntu 7.10)?
I think most Linux people use the command line for SVN, but there are a few front end apps http://sourceforge.net/projects/esvn (opens source) and http://www.syncrosvnclient.com/ (commercial)
I’m not sure how to export only changed files between revisions from the command line but I would definitely like to know. If anybody knows, please feel free to leave a comment.
About exporting only changed files between revisions from the command line.
I tried to implement it with simple shell script:
http://osmonitoring.com/mofio/
Hope this helps.
Thanks for this useful post!
Just what I was looking for. Thanks a lot!
Since TSVN 1.5 came out there are some minor changes. Here is a nice link to quick videos showing how to use basic TSVN features. Hope it helps you as well.
http://pollvu.blip.tv/
hamy
So easy, thanks!
Great post, it’s what I looking for.
Best regards.
i’ve always wondered how to do this. saved me a ton of time and i thank you for it.
Great post, help me very much. I’ve retweeted!
Thxs for this great post, it saved us a lot of time.
Thanks for this excellent tip!
Thanks for your tip. It’s really cool.
i have spent some time trying to figure this out when i first started using subversion a few years ago and gave up. Thanks for the reminder and solution!
A little bash script for those missing Tortoise
http://www.falconnet.fr/Subversion-export-des-fichiers.html
this is great. I wish, though, that I could do the same thing while selecting only certain revisions. For instance, I want all revisions having to do with a certain feature dating back 3 months, but don’t want any files associated with other features. Unfortunately the “compare revisions” menu item is not available unless you select all revisions between x and y. Any known workaround?
hey jeff, you might want to look into tagging – http://svnbook.red-bean.com/en/1.1/ch04s06.html