Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update a SVN file without performing a checkout?

Tags:

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.

like image 989
ccppjava Avatar asked Jun 13 '11 12:06

ccppjava


People also ask

Will svn update overwrite my changes?

When you update, the contents of your working copy are updated with all of the changes that have been committed to the repository since you last updated. Subversion is pretty smart about updating and never just overwrites files that have local changes with copies from the repository.

How do I update my TortoiseSVN repository?

To update, select the files and/or directories you want, right click and select TortoiseSVN → Update in the explorer context menu. A window will pop up displaying the progress of the update as it runs. Changes done by others will be merged into your files, keeping any changes you may have done to the same files.

How do I edit a TortoiseSVN file?

Click on the new working copy and right click to select the repository browser (TortoiseSVN -> Repo-browser) Right click the file of choice in the repository browser and select "Update item to revision"


1 Answers

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.

like image 96
David W. Avatar answered Sep 30 '22 06:09

David W.