Exporting only changed files from SVN

At work we've got a number of large projects that have a considerable number of very large binary resources that we manage under source control with SVN.

The problem we have is that some of the legacy projects have resource in folders underneath the code base rather than outside of the code base. This makes it difficult to update just the code from an export of a tag. This is exacerbated by the fact that the large resources are binary, so we can't patch using an svn diff.

For some time now I've been looking for a means to get a diff, pick up the files that have changed or added and export only those files into an appropriate directory structure that I can easily drop into place.

I finally have one!

I'm not sure how I haven't found this StackOverflow post previously, but find it I did.

On this post were a couple of different solutions. Most of them involve tortoiseSVN, which I detest for the number of times its destroyed working copies for me in the past. (It may be better now but I don't care it will never be installed on my computer ever!)

A chap called Phil Gloyne posted a jar file that he created to address this same issue. Unfortunately when I tried it out it seemed to blow up on the authentication and I couldn't easily work out what the problem was.

A frenchman by the name of Julien Falconnet posted a bash script that he'd created. This almost did what I wanted it to do, but is set to export the difference between specific revisions.

What I really needed was to export difference between two tags or urls in the repository rather two revisions, so I tweaked it to use URLs rather than revisions in the svn diff. This almost worked, but while spotted a flaw in the script when using two urls. Using only one url and revisions, the url in the summarized svn diff are the correct url to export from. When you use two urls the url in the summary are those of the OLD url and not the new url, so when the script exports the files, it gets the revision from the old url and fails to get file that have been added since the old tag was created.

Fortunately for me, Julien had already pulled the relative file path in order to build the correct file structure when exporting the files, so it was a simple matter to switch the export to use the new url with the relative file path instead of the one in the diff.

I am now a very happy man! A considerable weight and arduous task has now been lifted from my shoulders! A 15 minute task is now a 30second one. I hope it makes someone else out there very happy too.

Incidentally, should you still wish to use this script to export between revisions use the url form for revisions of svn diff OLD-URL[@OLDREV] NEW-URL[@NEWREV

NOTE : The bash script can be downloaded using the download button just below.

TweetBacks
Comments
I use something similar, a bash script i found here - http://www.electrictoolbox.com/subversion-export-c...

What i like about that script is it stores the current revision number in a file (.revision) and checks for it if you don't supply a revision_from argument
# Posted By Chris blackwell | 2/3/11 6:36 PM
I don't know! SVN Export scripts are like buses! You wait for ages and along come three! ;)

Thanks for that Chris. Personally I'm more interested in tags and and the head of branches than specific revisions, but I can see how that would be useful.

For the other script that came along Mike Henke pointed me to his blog post on exporting revisions using ant. (http://www.henke.ws/post.cfm/Subversion-Ant-for-Fi...) Thanks Mike.
# Posted By Stephen Moretti | 2/3/11 8:59 PM
This looks great Stephen but what are the parameters and how can I execute it from mac terminal?
# Posted By David | 5/26/11 5:38 AM
Hi David,

I'm a unbuntu and windows user so I can't say definitively, but I suspect you can.

To run this on windows I have a bash shell that I start up before executing this script. On ubuntu it just runs. ;-)
# Posted By Stephen Moretti | 5/26/11 6:51 AM
Ok thanks Stephen. How about parameters? How do I tell it to compare different tag urls?
# Posted By David | 5/26/11 6:16 PM
It's pretty simple really.

svnexport tagurl1 tagurl2 outputdirectorytagurl being the older and tagurl2 being the newer svn tag.
# Posted By Stephen Moretti | 5/26/11 11:17 PM
# Posted By Krishna Murty | 8/4/11 2:36 PM
@Krishna - noooooooo...... Not TortoiseSVN! That's not useful at all. That is a manual task every time. It is not something you can script and repeat.
# Posted By Stephen Moretti | 8/4/11 2:41 PM
You have made some excellent points there. Used to do they’re certified inside subject and barely found any specific info other websites, but great in order to be here, seriously, thanks.
# Posted By cqbutcherssupplies.com.au | 9/13/13 5:47 PM
contributed to this site. definitely seriously . It is nice to know that all the information I need is right in front of me. begin to tell you how much I, for one appreciate all you do!
# Posted By designer boutique | 9/29/13 11:50 AM