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

Re: [PATCH] make svnmucc consistently overwrite copy targets

From: Kevin Radke <kmradke_at_gmail.com>
Date: Tue, 4 Nov 2008 16:43:39 -0600

Sorry about the noise. Clicked the wrong "dev" list...

Kevin R.

On Tue, Nov 4, 2008 at 3:19 PM, Kevin Radke <kmradke_at_gmail.com> wrote:
> 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 23:44:03 CET

This is an archived mail posted to the TortoiseSVN Dev mailing list.

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