You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/04/23 19:28:02 UTC

svn commit: r937421 - /subversion/trunk/subversion/libsvn_client/copy.c

Author: philip
Date: Fri Apr 23 17:28:02 2010
New Revision: 937421

URL: http://svn.apache.org/viewvc?rev=937421&view=rev
Log:
* subversion/libsvn_client/copy.c (try_copy): Remove another svn_wc_entry_t.

Modified:
    subversion/trunk/subversion/libsvn_client/copy.c

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=937421&r1=937420&r2=937421&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Fri Apr 23 17:28:02 2010
@@ -2037,33 +2037,37 @@ try_copy(svn_commit_info_t **commit_info
 
               for (i = 0; i < copy_pairs->nelts; i++)
                 {
-                  const char *url;
+                  const char *src_abspath, *copyfrom_url, *url;
+                  svn_revnum_t base_rev, copyfrom_rev;
                   svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
                                                     svn_client__copy_pair_t *);
 
-                  /* We can convert the working copy path to a URL based on the
-                     entries file. */
-                  const svn_wc_entry_t *entry;
-                  const char *src_abspath;
-
                   svn_pool_clear(iterpool);
 
                   SVN_ERR(svn_dirent_get_absolute(&src_abspath, pair->src,
                                                   iterpool));
-                  SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx,
-                                                      src_abspath,
-                                                      svn_node_unknown,
-                                                      FALSE, FALSE,
-                                                      iterpool, iterpool));
-
-                  url = (entry->copied ? entry->copyfrom_url : entry->url);
+                  SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url,
+                                                         &copyfrom_rev,
+                                                         ctx->wc_ctx,
+                                                         src_abspath,
+                                                         pool, iterpool));
+                  if (copyfrom_url)
+                    url = copyfrom_url;
+                  else
+                    {
+                      SVN_ERR(svn_wc__node_get_url(&url, ctx->wc_ctx,
+                                                   src_abspath,
+                                                   pool, iterpool));
+                      SVN_ERR(svn_wc__node_get_base_rev(&base_rev, ctx->wc_ctx,
+                                                        src_abspath, iterpool));
+                    }
                   if (url == NULL)
                     return svn_error_createf
                       (SVN_ERR_ENTRY_MISSING_URL, NULL,
                        _("'%s' does not have a URL associated with it"),
                        svn_dirent_local_style(pair->src, pool));
 
-                  pair->src = apr_pstrdup(pool, url);
+                  pair->src = url;
 
                   if (!need_repos_peg_rev
                       || pair->src_peg_revision.kind == svn_opt_revision_base)
@@ -2071,7 +2075,7 @@ try_copy(svn_commit_info_t **commit_info
                       /* Default the peg revision to that of the WC entry. */
                       pair->src_peg_revision.kind = svn_opt_revision_number;
                       pair->src_peg_revision.value.number =
-                        (entry->copied ? entry->copyfrom_rev : entry->revision);
+                        (copyfrom_url ? copyfrom_rev : base_rev);
                     }
 
                   if (pair->src_op_revision.kind == svn_opt_revision_base)
@@ -2079,7 +2083,7 @@ try_copy(svn_commit_info_t **commit_info
                       /* Use the entry's revision as the operational rev. */
                       pair->src_op_revision.kind = svn_opt_revision_number;
                       pair->src_op_revision.value.number =
-                        (entry->copied ? entry->copyfrom_rev : entry->revision);
+                        (copyfrom_url ? copyfrom_rev : base_rev);
                     }
                 }
 



Re: svn commit: r937421 - /subversion/trunk/subversion/libsvn_client/copy.c

Posted by Philip Martin <ph...@wandisco.com>.
Greg Stein <gs...@gmail.com> writes:

> Is this conversion still going to work, noting the earlier discussion
> about children having entry->copyfrom_url == NULL, yet the node
> function returns non-NULL for all copied children?

I could not see why the code would care whether this was the root of
the copy or not.  Thinking about it a bit more, I probably fixed a
bug:

  svn cp wc/A wc/X
  svn cp -rN wc/X/B wc/Y

In the past this would fail because X/B doesn't have copyfrom.  Now it
copies from the URL of A@N.

-- 
Philip

Re: svn commit: r937421 - /subversion/trunk/subversion/libsvn_client/copy.c

Posted by Greg Stein <gs...@gmail.com>.
On Fri, Apr 23, 2010 at 13:28,  <ph...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_client/copy.c Fri Apr 23 17:28:02 2010
> @@ -2037,33 +2037,37 @@ try_copy(svn_commit_info_t **commit_info
>
>               for (i = 0; i < copy_pairs->nelts; i++)
>                 {
> -                  const char *url;
> +                  const char *src_abspath, *copyfrom_url, *url;
> +                  svn_revnum_t base_rev, copyfrom_rev;
>                   svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
>                                                     svn_client__copy_pair_t *);
>
> -                  /* We can convert the working copy path to a URL based on the
> -                     entries file. */
> -                  const svn_wc_entry_t *entry;
> -                  const char *src_abspath;
> -
>                   svn_pool_clear(iterpool);
>
>                   SVN_ERR(svn_dirent_get_absolute(&src_abspath, pair->src,
>                                                   iterpool));
> -                  SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx,
> -                                                      src_abspath,
> -                                                      svn_node_unknown,
> -                                                      FALSE, FALSE,
> -                                                      iterpool, iterpool));
> -
> -                  url = (entry->copied ? entry->copyfrom_url : entry->url);
> +                  SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url,
> +                                                         &copyfrom_rev,

Is this conversion still going to work, noting the earlier discussion
about children having entry->copyfrom_url == NULL, yet the node
function returns non-NULL for all copied children?

>...

Cheers,
-g