You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ne...@apache.org on 2010/06/29 23:36:29 UTC

svn commit: r959112 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/commit_util.c libsvn_client/copy.c libsvn_client/export.c libsvn_client/info.c libsvn_client/ra.c libsvn_client/url.c libsvn_wc/node.c

Author: neels
Date: Tue Jun 29 21:36:28 2010
New Revision: 959112

URL: http://svn.apache.org/viewvc?rev=959112&view=rev
Log:
Teach svn_wc__node_get_copyfrom_info() to also return the URL as separate root
and relpath. There should be no "real" changes with this patch except some
slight micro-optimisations (this isn't used yet, breaking up a larger patch).

* subversion/include/private/svn_wc_private.h,
* subversion/libsvn_wc/node.c
  (svn_wc__node_get_copyfrom_info):
    Add parameters COPYFROM_ROOT_URL and COPYFROM_REPOS_RELPATH.

* subversion/libsvn_client/commit_util.c (harvest_committables),
* subversion/libsvn_client/copy.c (calculate_target_mergeinfo, try_copy),
* subversion/libsvn_client/export.c (copy_versioned_files),
* subversion/libsvn_client/info.c (build_info_for_entry),
* subversion/libsvn_client/ra.c (svn_client__repos_locations),
* subversion/libsvn_client/url.c (svn_client__entry_location): 
    Pass NULL for the two new parameters of svn_wc__node_get_copyfrom_info(),
    except, when only the presence of copyfrom information is tested, don't
    bother to get a full URL and ask for the COPYFROM_REPOS_ROOT only.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_client/export.c
    subversion/trunk/subversion/libsvn_client/info.c
    subversion/trunk/subversion/libsvn_client/ra.c
    subversion/trunk/subversion/libsvn_client/url.c
    subversion/trunk/subversion/libsvn_wc/node.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=959112&r1=959111&r2=959112&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Tue Jun 29 21:36:28 2010
@@ -372,14 +372,20 @@ svn_wc__node_get_repos_relpath(const cha
  * copy information (versus being a member of the subtree beneath such
  * a copy target).
  *
- * If @a local_abspath is not copied, set @a *copyfrom_rev to NULL and
+ * @a copyfrom_root_url and @a copyfrom_repos_relpath return the exact same
+ * information as @a copyfrom_url, just still separated as root and relpath.
+ *
+ * If @a local_abspath is not copied, set @a *copyfrom_root_url, 
+ * @a *copyfrom_repos_relpath and @a copyfrom_url to NULL and
  * @a *copyfrom_rev to @c SVN_INVALID_REVNUM.
  *
- * Any of @a copyfrom_url, @a copyfrom_rev, or @a is_copy_target may
- * be NULL if the caller doesn't care about those values.
+ * Any out parameters may be NULL if the caller doesn't care about those
+ * values.
  */
 svn_error_t *
-svn_wc__node_get_copyfrom_info(const char **copyfrom_url,
+svn_wc__node_get_copyfrom_info(const char **copyfrom_root_url,
+                               const char **copyfrom_repos_relpath,
+                               const char **copyfrom_url,
                                svn_revnum_t *copyfrom_rev,
                                svn_boolean_t *is_copy_target,
                                svn_wc_context_t *wc_ctx,

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=959112&r1=959111&r2=959112&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Tue Jun 29 21:36:28 2010
@@ -522,7 +522,7 @@ harvest_committables(apr_hash_t *committ
           svn_boolean_t is_copy_target;
           /* ### TODO: sensibly align this call of get_copyfrom_info() with
            * the same call below (when checking added nodes). */
-          SVN_ERR(svn_wc__node_get_copyfrom_info(&is_copy, NULL,
+          SVN_ERR(svn_wc__node_get_copyfrom_info(&is_copy, NULL, NULL, NULL,
                                                  &is_copy_target, ctx->wc_ctx,
                                                  local_abspath, scratch_pool,
                                                  scratch_pool));
@@ -543,7 +543,7 @@ harvest_committables(apr_hash_t *committ
     {
       svn_boolean_t is_copy_target;
 
-      SVN_ERR(svn_wc__node_get_copyfrom_info(&node_copyfrom_url,
+      SVN_ERR(svn_wc__node_get_copyfrom_info(NULL, NULL, &node_copyfrom_url,
                                              &node_copyfrom_rev,
                                              &is_copy_target,
                                              ctx->wc_ctx, local_abspath,
@@ -572,7 +572,8 @@ harvest_committables(apr_hash_t *committ
           const char *parent_abspath = svn_dirent_dirname(local_abspath,
                                                           scratch_pool);
 
-          SVN_ERR(svn_wc__node_get_copyfrom_info(&parent_copyfrom_url,
+          SVN_ERR(svn_wc__node_get_copyfrom_info(NULL, NULL,
+                                                 &parent_copyfrom_url,
                                                  &parent_copyfrom_rev,
                                                  NULL,
                                                  ctx->wc_ctx, parent_abspath,

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=959112&r1=959111&r2=959112&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Tue Jun 29 21:36:28 2010
@@ -92,18 +92,18 @@ calculate_target_mergeinfo(svn_ra_sessio
   if (local_abspath)
     {
       svn_boolean_t is_added;
-      const char *copyfrom_url;
+      const char *is_copied;
 
       SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
       SVN_ERR(svn_wc__node_is_added(&is_added, ctx->wc_ctx,
                                     local_abspath, pool));
       if (is_added)
-        SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url, NULL, NULL,
-                                               ctx->wc_ctx, local_abspath,
-                                               pool, pool));
+        SVN_ERR(svn_wc__node_get_copyfrom_info(&is_copied, NULL, NULL,
+                                               NULL, NULL, ctx->wc_ctx,
+                                               local_abspath, pool, pool));
 
-      if (is_added && !copyfrom_url)
+      if (is_added && ! is_copied)
         {
           locally_added = TRUE;
         }
@@ -2102,8 +2102,8 @@ try_copy(svn_commit_info_t **commit_info
                   SVN_ERR_ASSERT(svn_dirent_is_absolute(pair->src_abspath_or_url));
 
                   SVN_ERR(svn_wc__node_get_copyfrom_info(
-                    &copyfrom_url, &copyfrom_rev, NULL, ctx->wc_ctx,
-                    pair->src_abspath_or_url, pool, iterpool));
+                    NULL, NULL, &copyfrom_url, &copyfrom_rev, NULL,
+                    ctx->wc_ctx, pair->src_abspath_or_url, pool, iterpool));
 
                   if (copyfrom_url)
                     {

Modified: subversion/trunk/subversion/libsvn_client/export.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=959112&r1=959111&r2=959112&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/export.c (original)
+++ subversion/trunk/subversion/libsvn_client/export.c Tue Jun 29 21:36:28 2010
@@ -326,11 +326,11 @@ copy_versioned_files(const char *from,
                                     from_abspath, pool));
       if (is_added)
         {
-          const char *copyfrom_url;
-          SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url, NULL, NULL,
-                                                 ctx->wc_ctx, from_abspath,
-                                                 pool, pool));
-          if (! copyfrom_url)
+          const char *is_copied;
+          SVN_ERR(svn_wc__node_get_copyfrom_info(&is_copied, NULL, NULL,
+                                                 NULL, NULL, ctx->wc_ctx,
+                                                 from_abspath, pool, pool));
+          if (! is_copied)
             return SVN_NO_ERROR;
         }
     }

Modified: subversion/trunk/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/info.c?rev=959112&r1=959111&r2=959112&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/info.c (original)
+++ subversion/trunk/subversion/libsvn_client/info.c Tue Jun 29 21:36:28 2010
@@ -126,7 +126,8 @@ build_info_for_entry(svn_info_t **info,
   if (! SVN_IS_VALID_REVNUM(tmpinfo->rev))
     tmpinfo->rev = 0;
 
-  SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url, &copyfrom_rev,
+  SVN_ERR(svn_wc__node_get_copyfrom_info(NULL, NULL,
+                                         &copyfrom_url, &copyfrom_rev,
                                          &is_copy_target, wc_ctx,
                                          local_abspath, pool, pool));
   if (is_copy_target)

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=959112&r1=959111&r2=959112&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Tue Jun 29 21:36:28 2010
@@ -588,7 +588,8 @@ svn_client__repos_locations(const char *
       SVN_ERR(svn_dirent_get_absolute(&local_abspath_or_url, path, subpool));
       SVN_ERR(svn_wc__node_get_url(&node_url, ctx->wc_ctx,
                                    local_abspath_or_url, pool, subpool));
-      SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url, &copyfrom_rev,
+      SVN_ERR(svn_wc__node_get_copyfrom_info(NULL, NULL,
+                                             &copyfrom_url, &copyfrom_rev,
                                              NULL, ctx->wc_ctx,
                                              local_abspath_or_url,
                                              pool, subpool));

Modified: subversion/trunk/subversion/libsvn_client/url.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/url.c?rev=959112&r1=959111&r2=959112&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/url.c (original)
+++ subversion/trunk/subversion/libsvn_client/url.c Tue Jun 29 21:36:28 2010
@@ -146,7 +146,8 @@ svn_client__entry_location(const char **
       || peg_rev_kind == svn_opt_revision_head)
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
 
-  SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url, &copyfrom_rev,
+  SVN_ERR(svn_wc__node_get_copyfrom_info(NULL, NULL,
+                                         &copyfrom_url, &copyfrom_rev,
                                          NULL, wc_ctx, local_abspath,
                                          result_pool, scratch_pool));
 

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=959112&r1=959111&r2=959112&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Tue Jun 29 21:36:28 2010
@@ -461,7 +461,9 @@ svn_wc__node_get_repos_relpath(const cha
 }
 
 svn_error_t *
-svn_wc__node_get_copyfrom_info(const char **copyfrom_url,
+svn_wc__node_get_copyfrom_info(const char **copyfrom_root_url,
+                               const char **copyfrom_repos_relpath,
+                               const char **copyfrom_url,
                                svn_revnum_t *copyfrom_rev,
                                svn_boolean_t *is_copy_target,
                                svn_wc_context_t *wc_ctx,
@@ -499,6 +501,10 @@ svn_wc__node_get_copyfrom_info(const cha
                                                       original_repos_relpath,
                                                       result_pool);
 
+      if (copyfrom_root_url)
+        *copyfrom_root_url = original_root_url;
+      if (copyfrom_repos_relpath)
+        *copyfrom_repos_relpath = original_repos_relpath;
       if (copyfrom_url)
         *copyfrom_url = my_copyfrom_url;
 
@@ -528,7 +534,8 @@ svn_wc__node_get_copyfrom_info(const cha
 
           /* This is a copied node, so we should never fall off the top of a
            * working copy here. */
-          SVN_ERR(svn_wc__node_get_copyfrom_info(&parent_copyfrom_url,
+          SVN_ERR(svn_wc__node_get_copyfrom_info(NULL, NULL,
+                                                 &parent_copyfrom_url,
                                                  NULL, NULL,
                                                  wc_ctx, parent_abspath,
                                                  scratch_pool, scratch_pool));
@@ -570,6 +577,12 @@ svn_wc__node_get_copyfrom_info(const cha
                                             scratch_pool);
           if (src_relpath)
             {
+              if (copyfrom_root_url)
+                *copyfrom_root_url = original_root_url;
+              if (copyfrom_repos_relpath)
+                *copyfrom_repos_relpath = svn_dirent_join(
+                                            original_repos_relpath,
+                                            src_relpath, result_pool);
               if (copyfrom_url)
                 *copyfrom_url = svn_path_url_add_component2(src_parent_url,
                                                             src_relpath,