[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Svn copy does not work if destination file already exist

From: Stephen Butler <sbutler_at_elego.de>
Date: Fri, 23 Jan 2009 18:18:16 +0100

Quoting Vishal Gangwal <vishalgangwal_at_waterford.org>:

> Hi
>
> Svn copy does not work if destination file already exist . For example
> if we have file trunk/a.txt and we use " svn copy trunk/a.txt tags/a.txt
> " .
> It will copy file trunk/a.txt into tags directory as a.txt .
>
> Now we modify file trunk/a.txt and again we want to use " svn copy
> trunk/a.txt tags/a.txt " , so that a.txt in tags directory is updated
> copy of a.txt in trunk directory.
> But svn gives following error :
> svn: Failure opening '/tags/a.txt/a.txt'
> svn: '/trunk/a.txt' is not a directory in filesystem '/repos/test/db'
>
> So we are using " svn del tags/a.txt " and then " svn copy trunk/a.txt
> tags/a.txt "
>
> Is there any other way to achieve this ?

If path B does not exist, 'svn copy A B' works as you expect.

If B is a directory, A will be copied to B/A.

If B is a file, you will get the error you found.

To solve your problem:

If A was copied to B, and in the meantime you have made changes
to A that should also be applied to B, then use svn merge, not
svn copy. Basically, check out a working copy of B, and run
'svn merge A' in it.

Merging is a powerful feature. See the SVN Book for more info.

   http://svnbook.red-bean.com/

Regards,
Steve

-- 
Stephen Butler | Software Developer
elego Software Solutions GmbH
Gustav-Meyer-Allee 25 | 13355 Berlin | Germany
fon: +49 30 2345 8696 | mobile: +49 163 25 45 015
fax: +49 30 2345 8695 | http://www.elegosoft.com
Geschäftsführer: Olaf Wagner | Sitz der Gesellschaft: Berlin
Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
-- 
Stephen Butler | Software Developer
elego Software Solutions GmbH
Gustav-Meyer-Allee 25 | 13355 Berlin | Germany
fon: +49 30 2345 8696 | mobile: +49 163 25 45 015
fax: +49 30 2345 8695 | http://www.elegosoft.com
Geschäftsführer: Olaf Wagner | Sitz der Gesellschaft: Berlin
Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
Received on 2009-01-23 18:19:10 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.