tags:

views:

10576

answers:

4

I'm adding an existing site to SVN.

The files already exist on the webserver, and now identical copies (- config files) exist in the repo.

I want to convert the webserver directory into an SVN working copy, but when I run:

svn checkout http://path.to/svn/repo/httpdocs .

I get the error: "svn: Failed to add file '': object of the same name already exists"

Any ideas on how to tell svn to just overwrite those files whose contents are the same?

+1  A: 

Pull from the repo to a new directory, then rename the old one to old_crufty, and the new one to my_real_webserver_directory, and you're good to go.

If your intention is that every single file is in svn, then this is a good way to test your theory. If your intention is that some files are not in svn, then use Brian's copy/paste technique.

Ned Batchelder
+9  A: 

Have you tried the --force option?

'svn help checkout' gives the details.

Will Dean
My version of SVN (1.3.1) doesn't seem to have a --force option. When was this added?
David Laing
1.4, I think, though I'm sure you'll be as good at checking the release notes as I would... Is there are reason why you're so far behind? The SVN project is very well run with respect to backwards compatibility, so there is little reason to fear upgrades.
Will Dean
Yeah - hosted server is running Ubuntu 6.0.6; which has svn 1.3 as the standard install. Thanks
David Laing
This option was added in Subversion 1.5. It also added --accept theirs-full if you want to force updating on conflicts. (As you might want to on build servers)
Bert Huijben
+1  A: 

This can be done pretty easily. All i did was move the existing directory, not under version control, to a temp directory; Then checked out the svn version to my correct directory name; copied the files from the temp director into the svn directory; then reverted the files in the svn directory. If that does not make sense there is an example below:

/usr/local/www

mv www temp_www svn co http://www.yourrepo.com/therepo www cp -pR ./temp_www/* ./www svn revert -R ./www/* svn update

hope this helps, and not sure why just a simple svn update did not change the files back?

Cheers Dave

A: 

svn checkout --force svn://repo website.dir

then

svn revert -R website.dir

Will check out on top of existing files in website.dir, but not overwrite them. Then the revert will overwrite them. This way you do not need to take the site down to complete it.