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

Re: SVN Copy when directory exists

From: Duncan Booth <duncan.booth_at_suttoncourtenay.org.uk>
Date: 2007-11-13 12:29:30 CET

John Peacock <john.peacock@havurah-software.org> wrote:

> No, actually that is exactly how it works under *nix (at least, don't
> have Windows handy to check).

Windows behaves pretty much as Daniel expected SVN to behave:

   COPY sourcedir target

If target exists copies all files in sourcedir into target. If target
does not exist you get an error message. (Whereas

  XCOPY sourcedir target

copies all files in sourcedir into target. If target does not exist it
is created first.

Both approaches have advantages and disadvantages, but they are mutually
inconsistent. SVN has chosen to be self-consistent across platforms
while not being consistent with the copy command on individual
platforms.

Note that while Unix 'cp' accepts multiple source paths for a single
destination, Windows COPY/XCOPY only have a single source path which may
include wildcard characters. This would make the windows behaviour
almost impossible to implement successfully on Unix where the shell
expands wildcards.

>
>> E.g.
>> > svn copy trunk branches/branch_name
>> A branches\branch_name
>>
>> > svn copy trunk branches/directory_exists
>> A branches\directory_exists\trunk
>
> What did you expect this to do? Did you expect that it would replace
> the contents of the previous branch? If so, the sequence is simply
>
> $ svn delete branches/directory_exists
> $ svn copy trunk branches/directory_exists
>
> and you are good to go.
>
An alternative, albeit longer sequence to make a branch exactly match
the trunk is:

 svn switch wc branchurl/directory_exists
 svn merge branchurl/directory_exists trunkurl wc
 svn commit -m 'Brought branch in line with trunk' wc
 svn switch wc trunkurl

which has the advantage of keeping the branch history intact.

It is a pity though that there is no single command to create a branch
or tag, and either fail if it already exists or (with --force) overwrite
it but keeping the history.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Nov 13 13:20:18 2007

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.