VerySimple Developer Blog
Technical Tips, Tricks and Rants.
 
Sep
06
Filed Under (Announcements, SVN) by Jason on 06-09-2007

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 or need anything beyond that.

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 for this is when you are working on a web application and it’s time to deploy all the recent changes to the production server.  You might think that you need to delve into tagging and branching to do this, but that is not necessary.

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.

 

Comments:
7 Comments posted on "Using TortoiseSVN to Export Only New/Modified Files"
BrettN on September 11th, 2007 at 6:20 pm #

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?


Jason on September 15th, 2007 at 2:28 pm #

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.


[...] files up from a defined version of our Subversion repository, a fast Google search provided this useful article. It’s worth a reading.Mike Tags: svn, tricks Category: Software  |  Comment [...]


Joao on January 3rd, 2008 at 12:37 am #

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)?


Jason on January 5th, 2008 at 11:02 pm #

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.


Wik on February 1st, 2008 at 5:40 pm #

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.


William ? Brasil on May 14th, 2008 at 11:24 pm #

Thanks for this useful post!


Post a comment

Name: 
Email: 
URL: 
Comments: 
Close
  • Social Web

NOTE: Email is disabled

E-mail It