How to update a SVN file without performing a checkout

svn

I am writing some scripts to update the Linux box's SVN repo with newer versions of xml files. The repo is huge, and there is no checkout version on the same box. The idea is to update the xml without a working copy. Is that possible or do I need to checkout to a temporary folder, copy/overwrite, check in and delete temporary folder?

Edit: Thanks very much for your answers so far.

I know that you can do it with API and code, not sure if any SVN command does so…

Many thanks.

Best Answer

Is the issue that you don't want to bother with the checkout, or because you are afraid that if you do a checkout, you'll have to checkout a lot of files?

You have to do a checkout in Subversion. You can't simply submit changes without a working copy. (Not entirely true, you can do svn delete and svn mkdir without a checkout.)

However, you can limit the amount of files that do get checked out with the --depth switch. For example, you can do the following:

$ svn co --depth=empty http://myserver/myrepos/mydirectory

This will checkout the directory, but without any files in it. You can then do an svn update of just the files you want to modify, then commit those changes:

$ cd mydirectory            #Enter the empty working copy just checked out
$ svn update fileToChange   #Adds file you want to change to your working dir
$ edit fileToChange.xml
$ svn commit -m "Modified 'fileToChange.xml' with latest version"

This will allow you to change the file fileToChange.xml without having to checkout the entire directory.