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

RE: Re: SVN Copy when directory exists

From: Daniel Becroft <Daniel.Becroft_at_supercorp.com.au>
Date: 2007-11-13 23:57:37 CET

> -----Original Message-----
> From: news [mailto:news@ger.gmane.org]On Behalf Of Duncan Booth
> Sent: Tuesday, 13 November 2007 9:30 PM
> To: users@subversion.tigris.org
> Subject: Re: SVN Copy when directory exists
>
>
> 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.

The problem came about as we were trying to create a branch at branches/1.0/devel, which would be a copy of trunk. We tried to do it in one step, but of course the 1.0 directory did not exist. As an aside, I seem to remember some talk, maybe on the -dev list, about a create-parent switch, but I think that might be in 1.5.

I guess an error would have been useful, but it was more my mistake that caused the confusion in the first place.

Regards,
Daniel B.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Nov 14 00:00:33 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.