Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN Export Only Changed Files

Tags:

bash

svn

I currently commit files to my SVN server (which is located on my web host), and from there I SSH in and export them to the working directory in my htdocs.

As my application gets larger and larger, a full export is a waste of time. How can I only export the files that have been changed?

svn export -r xxxx:HEAD http://svn/

Is a solution I had found, so maybe this can help? How can I automatically get the revision?

like image 303
Pete Avatar asked Jun 08 '10 14:06

Pete


2 Answers

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.

like image 145
Loftx Avatar answered Sep 22 '22 03:09

Loftx


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.

like image 42
User123342234 Avatar answered Sep 20 '22 03:09

User123342234