On Thu, 15 Sep 2005, dlr@tigris.org wrote:
> Author: dlr
> Date: Thu Sep 15 18:55:47 2005
> New Revision: 16141
>
> Modified:
> trunk/subversion/libsvn_wc/copy.c
> trunk/subversion/tests/clients/cmdline/copy_tests.py
> trunk/subversion/tests/clients/cmdline/svntest/main.py
>
> Log:
> Fixed issue 2404 by disallowing copy or move (copy plus delete)
> operations between working copies from different repositories.
>
>
> * subversion/libsvn_wc/copy.c
> (svn_wc_copy2): Open the svn_wc_adm_access_t * to src_path earlier,
> still assuming that it is okay to bail out of this function if an
> error is encountered without calling svn_wc_adm_close(). Use
> svn_path_split_if_file() to dissect src_path_dir from src_path, and
> grab its svn_wc_entry_t * for comparison of repository URIs to
> dst_entry. Return an error if they don't match. Note that we
> might now be able to avoid a call to svn_io_check_path() (since we
> already have the node kind in hand at that point). I didn't remove
> this in fear of removing necessary error checking.
...
> --- trunk/subversion/libsvn_wc/copy.c (original)
> +++ trunk/subversion/libsvn_wc/copy.c Thu Sep 15 18:55:47 2005
> @@ -516,19 +516,31 @@
> {
> svn_wc_adm_access_t *adm_access;
> svn_node_kind_t src_kind;
> - const svn_wc_entry_t *entry;
> + const svn_wc_entry_t *dst_entry, *src_entry;
> + const char *src_path_dir, *src_path_file;
>
> - SVN_ERR (svn_wc_entry (&entry, svn_wc_adm_access_path (dst_parent),
> + SVN_ERR (svn_wc_adm_probe_open3 (&adm_access, NULL, src_path, FALSE, -1,
> + cancel_func, cancel_baton, pool));
> +
> + SVN_ERR (svn_wc_entry (&dst_entry, svn_wc_adm_access_path (dst_parent),
> dst_parent, FALSE, pool));
> - if (entry->schedule == svn_wc_schedule_delete)
> + SVN_ERR (svn_path_split_if_file (src_path, &src_path_dir, &src_path_file,
> + pool));
> + SVN_ERR (svn_wc_entry (&src_entry, src_path_dir, adm_access, FALSE, pool));
> + if (strcmp (src_entry->repos, dst_entry->repos) != 0)
> + return svn_error_createf
> + (SVN_ERR_WC_INVALID_SCHEDULE, NULL,
> + _("Cannot copy to '%s', as it is not from repository '%s'"),
> + svn_path_local_style (svn_wc_adm_access_path (dst_parent), pool),
> + src_entry->repos);
> + if (dst_entry->schedule == svn_wc_schedule_delete)
> return svn_error_createf
> (SVN_ERR_WC_INVALID_SCHEDULE, NULL,
> _("Cannot copy to '%s' as it is scheduled for deletion"),
> svn_path_local_style (svn_wc_adm_access_path (dst_parent), pool));
>
> - SVN_ERR (svn_wc_adm_probe_open3 (&adm_access, NULL, src_path, FALSE, -1,
> - cancel_func, cancel_baton, pool));
> -
> + /* ### Can this call be avoided, since we now already have
> + ### src_entry->kind, or is it still needed for error handling? */
> SVN_ERR (svn_io_check_path (src_path, &src_kind, pool));
>
> if (src_kind == svn_node_file)
>
Is the error handling provided by svn_io_check_path() necessary to
svn_wc_copy2(), or does the latter really only care about the file type
of the "source" argument to the copy command?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep 16 20:26:52 2005