Vijay Dev
Vijay Dev

Reputation: 27496

SVN Update of multiple files

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.

Upvotes: 2

Views: 16523

Answers (5)

mithrandi
mithrandi

Reputation: 1650

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

Upvotes: 6

rjray
rjray

Reputation: 6753

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.

Upvotes: 9

Ken
Ken

Reputation: 78922

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.

Upvotes: 5

Jon Topper
Jon Topper

Reputation: 3097

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

Upvotes: 0

Mr Fooz
Mr Fooz

Reputation: 111996

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.

Upvotes: 1

Related Questions