tags:

views:

2853

answers:

5

How to do svn update of multiple files located across different directories ?

For committing multiple files from different directories, we can put them all up in a text file and give that file as an argument to svn commit and it will happily commit all those files. But update ?

EDIT: Mr. Fooz's answer is definitely an option whereby I can create a .bat or .sh file with all the svn updates. But I would like to know if there are any special arguments that svn provide that can be used instead of a file with loads of svn update commands in it. Please note that the file that is used by svn commit contains only the filenames and no svn commands.

+1  A: 

If you don't mind creating a separate file with a canned list of directories, you could make it a shell script or .bat file (depending on your platform) and place N individual svn update calls in it.

Mr Fooz
A: 

THe fact that you even want to do this suggests to me that you're perhaps not using subversion particularly sensibly.

Jon Topper
You are right in the ideal situation, but with multiple projects may not always work that well. In our case we have one platform and multiple customer projects. The customer projects have to go into separate repositories so they can't access each others logs/data etc.
Peter Olsson
@Jon Topper: I don't understand what you mean by that ? It would help if you can explain a bit. I have a specific need of getting only a particular set of files updated in my working copy. I don't want to mess up with other files that might lead to conflicts.
Vijay Dev
+2  A: 

You can specify multiple folders in the update command:

svn update docs foo/bar/ /repos/bar

If you are really trying to limit yourself to updating individual files I have to agree with Jon Topper that you might be off track.

Ken
+1  A: 

Given that there are valid reasons for selectively updating from a repository when there are a lot of downstream changes available, my question would be whether you're trying to do this on a UNIX/Linux/etc. system or Windows. If Windows, I don't know how to do an equivalent of the following:

svn update `cat list_of_files`

(There are corner-cases, similar to running "find ... | xargs cmd ...", where spaces or shell-sensitive characters in the file names could cause problems. You'll have to deal with those by properly escaping such problem-characters.)

If, for some frightening reason, your list of files is so astronomically-large that it breaks the shell command-line-length limit, you can do this instead:

cat list_of_files | xargs svn update

Two things to keep in mind while using either of these:

  1. All file names will have to be either absolute, or relative to the point you're running the command from.
  2. If one of the "files" in your list is actually a directory, all the files in that directory that have changes available will be updated.
rjray
+3  A: 

Subversion has a "changelists" feature (new in 1.5, I believe) that allows you to define a named changelist by doing:

svn changelist yourlist file1 file2 file3 ...

Once defined, you can pass --changelist to several commands, including svn update, and they will only operate on the files associated with that changelist. For example:

svn update --changelist yourlist
mithrandi