SVN Export Only Changed Files SVN Export Only Changed Files bash bash

SVN Export Only Changed Files


I have been using the following Bash script:

for i in $(svn diff --summarize -r 1:2 http://repo_path | awk '{ print $2 }'); do p=$(echo $i | sed -e 's{http://repo_path/{{'); mkdir -p $(dirname $p); svn export $i $p; done 

Similar to hudolejev's solution, it outputs the changes between revisions (1 and 2) in this case and loops over the files and folders.


This works with the use of Tortoise SVN. I'm not sure it can be done without it.

I had a similar issue where I had made changes to several thousand files (dont ask...it is an inherited problem!) out of 10's of thousands, so I didn't want to upload the whole directory or rely on winscp to correctly match the dates (since this server is in the US and im in AUS).

So I checked-in to SVN then via "Show Log" in Tortoise SVN. I then right-clicked on the most recent revision (although it could be any rev you live) and selected "compare with previous revision". I then selected all the files that appeared (CTRL-A) and right-clicked "export selection to" and BAM all the updated files in correct folder structure are saved and ready for upload.


No pure-SVN solution exists that I am aware of, but you can try the following:

svn update | egrep "^(A|U)[ ]+(.*)" | cut -b 2 | xargs -i cp -R "{}" /path/to/public_html

In your working directory, you get an update and parse the output -- svn update.

All files marked with A and U are candidates to copy -- egrep "^(A|U)[ ]+(.*)".

Remove A or U to get the file name -- cut -b 2.

Copy files that changed since your last update -- xargs -i cp -R "{}" /path/to/public_html.

(Sorry for clumsy shell-fu, still learning).

EDIT: Use cut instead of tr (fixed)