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

Re: [PATCH] Issue 1643: Cannot copy -rBASE while in WC

From: <kfogel_at_collab.net>
Date: 2003-12-22 19:13:24 CET

John Szakmeister <john@szakmeister.net> writes:
> Well, I made a patch for this problem to at least get the command working.
> However, it's not an ideal solution since it will go to the network and
> contact the repository. I looked at making it go to the text-base, and it
> turned out that was going to be a significant change. One that I would feel
> uncomfortable committing while we're in Beta.

(Thanks for the conservativism :-) ).

Might be good to attach this patch to the issue, even if you're not
sure it's th best solution.

-K

> Log:
> Stop 'svn copy -rBASE wc_path1 wc_path2' from failing. This isn't the ideal
> answer since it will contact the repository, but presented the least amount of
> change given that we're on our way to 1.0.
>
> * subversion/libsvn_client/copy.c
> (repos_to_wc_copy): Updated this function to now take a WC path as a
> parameter, to allow keywords like BASE, PREV, and COMMITTED to be resolved.
> Renamed src_url parameter to src_path_or_url to reflect the change.
>
> (setup_copy): Stop referring to parameters as being URLs. Instead, indicate
> whether or not we want to go to the repository for the source or
> destination. Also, stop resolving a source path to a URL in the repos->wc
> case. Instead, let repos_to_wc_copy() resolve it, since it needs to wc path
> to resolve the revision parameter correctly.
>
>
> Index: subversion/libsvn_client/copy.c
> ===================================================================
> --- subversion/libsvn_client/copy.c (revision 8036)
> +++ subversion/libsvn_client/copy.c (working copy)
> @@ -155,7 +155,6 @@
> ctx->cancel_func, ctx->cancel_baton,
> ctx->notify_func, ctx->notify_baton, pool));
>
> -
> if (is_move)
> {
> SVN_ERR (svn_wc_delete (src_path, src_access,
> @@ -728,7 +727,7 @@
>
>
> static svn_error_t *
> -repos_to_wc_copy (const char *src_url,
> +repos_to_wc_copy (const char *src_path_or_url,
> const svn_opt_revision_t *src_revision,
> const char *dst_path,
> svn_client_ctx_t *ctx,
> @@ -740,9 +739,31 @@
> svn_revnum_t src_revnum;
> svn_wc_adm_access_t *adm_access;
> const char *src_uuid = NULL, *dst_uuid = NULL;
> + const char *src_url;
> svn_boolean_t same_repositories;
> svn_opt_revision_t revision;
>
> + if (! svn_path_is_url (src_path_or_url))
> + {
> + /* We can convert the working copy path to a URL based on the
> + entries file. */
> + const svn_wc_entry_t *entry;
> + SVN_ERR (svn_wc_adm_probe_open (&adm_access, NULL, src_path_or_url,
> + FALSE, FALSE, pool));
> + SVN_ERR (svn_wc_entry (&entry, src_path_or_url, adm_access, FALSE,
> + pool));
> + SVN_ERR (svn_wc_adm_close (adm_access));
> +
> + if (! entry)
> + return svn_error_createf
> + (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
> + "'%s' is not under version control", src_path_or_url);
> +
> + src_url = entry->url;
> + }
> + else
> + src_url = src_path_or_url;
> +
> /* Get the RA vtable that matches URL. */
> SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
> SVN_ERR (svn_ra_get_ra_library (&ra_lib, ra_baton, src_url, pool));
> @@ -764,7 +785,8 @@
> revision.kind = svn_opt_revision_head;
>
> SVN_ERR (svn_client__get_revision_number
> - (&src_revnum, ra_lib, sess, &revision, NULL, pool));
> + (&src_revnum, ra_lib, sess, &revision,
> + src_url == src_path_or_url ? NULL : src_path_or_url, pool));
>
> /* Verify that SRC_URL exists in the repository. */
> SVN_ERR (ra_lib->check_path (sess, "", src_revnum, &src_kind, pool));
> @@ -977,13 +999,13 @@
> svn_client_ctx_t *ctx,
> apr_pool_t *pool)
> {
> - svn_boolean_t src_is_url, dst_is_url;
> + svn_boolean_t src_use_repos, dst_use_repos;
>
> /* Are either of our paths URLs? */
> - src_is_url = svn_path_is_url (src_path);
> - dst_is_url = svn_path_is_url (dst_path);
> + src_use_repos = svn_path_is_url (src_path);
> + dst_use_repos = svn_path_is_url (dst_path);
>
> - if (!src_is_url && !dst_is_url
> + if (!src_use_repos && !dst_use_repos
> && svn_path_is_child (src_path, dst_path, pool))
> return svn_error_createf
> (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
> @@ -992,7 +1014,7 @@
>
> if (is_move)
> {
> - if (src_is_url == dst_is_url)
> + if (src_use_repos == dst_use_repos)
> {
> if (strcmp (src_path, dst_path) == 0)
> return svn_error_createf
> @@ -1025,46 +1047,31 @@
> }
> else
> {
> - if (!src_is_url)
> + if (!src_use_repos)
> {
> if (src_revision->kind != svn_opt_revision_unspecified
> && src_revision->kind != svn_opt_revision_working)
> {
> - /* We can convert the working copy path to a URL based on the
> - entries file. */
> - svn_wc_adm_access_t *adm_access; /* ### FIXME local */
> - const svn_wc_entry_t *entry;
> - SVN_ERR (svn_wc_adm_probe_open (&adm_access, NULL, src_path,
> - FALSE, FALSE, pool));
> - SVN_ERR (svn_wc_entry (&entry, src_path, adm_access, FALSE,
> - pool));
> - SVN_ERR (svn_wc_adm_close (adm_access));
> -
> - if (! entry)
> - return svn_error_createf
> - (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
> - "'%s' is not under version control", src_path);
> -
> - src_path = entry->url;
> - src_is_url = TRUE;
> + /* Go to the repository for the copy. */
> + src_use_repos = TRUE;
> }
> }
> }
>
> /* Now, call the right handler for the operation. */
> - if ((! src_is_url) && (! dst_is_url))
> + if ((! src_use_repos) && (! dst_use_repos))
> {
> SVN_ERR (wc_to_wc_copy (src_path, dst_path,
> is_move, force,
> ctx,
> pool));
> }
> - else if ((! src_is_url) && (dst_is_url))
> + else if ((! src_use_repos) && (dst_use_repos))
> {
> SVN_ERR (wc_to_repos_copy (commit_info, src_path, dst_path,
> ctx, pool));
> }
> - else if ((src_is_url) && (! dst_is_url))
> + else if ((src_use_repos) && (! dst_use_repos))
> {
> SVN_ERR (repos_to_wc_copy (src_path, src_revision,
> dst_path, ctx,

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Dec 22 20:04:03 2003

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.