svnmucc would allow an user to use "CP REV SRC DST" when both SRC and DST URLs
were directories. It would (silently) "replace" DST with SRC. When
used with specific
file names it would return an error that "DST already exists".
For example, this would work fine, even if tags/dira exists:
svnmucc CP HEAD http://server/repo/trunk/dira http://server/repo/tags/dira
This would fail if tags/dira/file1.txt exists:
svnmucc CP HEAD http://server/repo/trunk/dira/file1.txt
http://server/rrepo/tags/dira/file1.txt
This simple patch makes it consistently "replace" the target no matter
if it is a
file or a directory. I believe this functionality is much nicer, since the user
does not need to "check and delete if exists" before doing the copy operation.
The svnmucc directory behavior was already different than "svn cp", which
places a directory inside an existing target directory. "svn cp" also fails to
directly overwrite an existing file and there is not a "force" or "overwrite"
option.
This change makes it a nice alternative to allow easily "sliding" a label
for both directories and files without complicated wrapper scripts.
It would be nice to make this into the 1.6 release if possible.
(And even 1.5 patch releases if needed.)
Kevin R.
[[[
Consistently replace copy target for both directories and files
* contrib/client-side/svnmucc/svnmucc.c
(build): If copy target path exists make it a REPLACE operation
]]]
Index: contrib/client-side/svnmucc/svnmucc.c
===================================================================
--- contrib/client-side/svnmucc/svnmucc.c (revision 34049)
+++ contrib/client-side/svnmucc/svnmucc.c (working copy)
@@ -485,6 +485,14 @@
if (operation->kind == svn_node_none)
return svn_error_createf(SVN_ERR_BAD_URL, NULL,
"'%s' not found", url);
+ if (operation->operation == OP_ADD)
+ {
+ /* Use the replace option if target path already exists */
+ SVN_ERR(svn_ra_check_path(session, path,
+ head, &operation->kind, pool));
+ if (operation->kind != svn_node_none)
+ operation->operation = OP_REPLACE;
+ }
operation->url = url;
operation->rev = rev;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: dev-help_at_tortoisesvn.tigris.org
Received on 2008-11-04 22:20:03 CET