tags:

views:

271

answers:

4

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?

+1  A: 

I would do an SVN checkout into a local repositore, and then rsync the changed files into the web root. Or just do the checkout into the webroot and deny access to all .svn directories. No other possibilities exists.

Daniel
A: 

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)

hudolejev
+1 for nice command line. I would create a small bash script from it. This again can be remotely called by using the "putty" "remote command" feature, so you can do the update with a click of an icon on your desktop.
Daniel
A: 

This works with the use of Tortoise SVN. I'm not sure it can be dont 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.

Josh Stuart
A: 

I'm not sure if this is the same problem you're referring to, but when committing files for a web application I'm working on, I've used the svn2ftp.py SVN hook to automatically FTP modified files to a staging server. It was pretty easy to install and I've never had a problem with it.

Chris S