You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Johan Holmberg <ho...@iar.se> on 2006/08/21 13:09:57 UTC
"svn cp" too smart about existing directories?
Hi!
When I create a branch or tag I use a command like:
$ svn cp -mMSG http://HOST/myproj/trunk \
http://HOST/myproj/branches/foo
But I just discovered that I can issue the same command two times
without getting an error the second time. The *third* time I get an
error. I had hoped that the second time would give and error.
The explanation seem to be that "svn cp" is "smart" the second time and
detects that the directory "myproj/branches/foo" exist, and then decides
to create "myproj/branches/foo/trunk" instead.
I have looked around and tried different ways to disable this behaviour,
but without any success.
It seems that "svn cp" is using the same tactic as cp(1) on UN*X. But is
this really a good idea? It seems to me that it should be possible to
write a "svn" command in such a way that it *means* the same thing,
independently of how what repository happens to looks like.
( I come to think about rsync(1) that has solved this by having trailing
"/" being significant in pathnames )
Have I missed some way of accomplishing what I want?
/Johan Holmberg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: "svn cp" too smart about existing directories?
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Aug 21, 2006, at 15:09, Johan Holmberg wrote:
> When I create a branch or tag I use a command like:
>
> $ svn cp -mMSG http://HOST/myproj/trunk \
> http://HOST/myproj/branches/foo
>
> But I just discovered that I can issue the same command two times
> without getting an error the second time. The *third* time I get an
> error. I had hoped that the second time would give and error.
>
> The explanation seem to be that "svn cp" is "smart" the second time
> and detects that the directory "myproj/branches/foo" exist, and
> then decides to create "myproj/branches/foo/trunk" instead.
>
> I have looked around and tried different ways to disable this
> behaviour, but without any success.
>
> It seems that "svn cp" is using the same tactic as cp(1) on UN*X.
> But is this really a good idea? It seems to me that it should be
> possible to write a "svn" command in such a way that it *means* the
> same thing, independently of how what repository happens to looks
> like.
>
> ( I come to think about rsync(1) that has solved this by having
> trailing "/" being significant in pathnames )
>
> Have I missed some way of accomplishing what I want?
No, I don't think you've missed anything. Yes, Subversion does
function the way you describe, and I believe it is indeed because
that's the way the standard Unix cp command works. I don't know of
any way to disable that behavior there either.
If you want to receive an error when copying to a location that
already exists, instead of having Subversion copy into that location
as it currently does, you could probably write a wrapper script
around the svn command which works in this manner.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org