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

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

Author: cmpilato
Date: Fri Apr 23 19:55:45 2010
New Revision: 937491

URL: http://svn.apache.org/viewvc?rev=937491&view=rev
Log:
Teach svn_wc__node_get_copyfrom_info() to handle optional return
values and (optionally) return the information required to tell the
difference between "direct target of a copy" and "item in a copied
subtree".

* subversion/include/private/svn_wc_private.h
  (svn_wc__node_get_copyfrom_info): Add 'is_copy_target' parameter,
    and update docstring.

* subversion/libsvn_wc/node.c
  (svn_wc__node_get_copyfrom_info): Add 'is_copy_target' parameter and
    handling, plus allow any of the return variables to be NULL.

* subversion/libsvn_client/ra.c
  (svn_client__repos_locations): Update call to 
    svn_wc__node_get_copyfrom_info().

* subversion/libsvn_client/url.c
  (svn_client__entry_location): Update call to
    svn_wc__node_get_copyfrom_info().

* subversion/libsvn_wc/copy.c
  (copy_file_administratively, copy_dir_administratively): Update call to
    svn_wc__node_get_copyfrom_info().

* subversion/libsvn_client/copy.c
  (try_copy): Update call to svn_wc__node_get_copyfrom_info().

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_client/ra.c
    subversion/trunk/subversion/libsvn_client/url.c
    subversion/trunk/subversion/libsvn_wc/copy.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=937491&r1=937490&r2=937491&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Fri Apr 23 19:55:45 2010
@@ -363,13 +363,20 @@ svn_wc__node_get_url(const char **url,
 /**
  * Set @a *copyfrom_url to the corresponding copy-from URL, and @a
  * copyfrom_rev to the corresponding copy-from revision, of @a
- * local_abspath, using @a wc_ctx.  If @a local_abspath is not copied,
- * set @a *copyfrom_rev to NULL and @a *copyfrom_rev to @c
- * SVN_INVALID_REVNUM.
+ * local_abspath, using @a wc_ctx.  Set @a is_copy_target to TRUE iff
+ * @a local_abspath was the target of a 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_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.
  */
 svn_error_t *
 svn_wc__node_get_copyfrom_info(const char **copyfrom_url,
                                svn_revnum_t *copyfrom_rev,
+                               svn_boolean_t *is_copy_target,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                apr_pool_t *result_pool,

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=937491&r1=937490&r2=937491&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Fri Apr 23 19:55:45 2010
@@ -2048,7 +2048,7 @@ try_copy(svn_commit_info_t **commit_info
                                                   iterpool));
                   SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url,
                                                          &copyfrom_rev,
-                                                         ctx->wc_ctx,
+                                                         NULL, ctx->wc_ctx,
                                                          src_abspath,
                                                          pool, iterpool));
                   if (copyfrom_url)

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=937491&r1=937490&r2=937491&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Fri Apr 23 19:55:45 2010
@@ -596,7 +596,8 @@ svn_client__repos_locations(const char *
       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,
-                                             ctx->wc_ctx, local_abspath_or_url,
+                                             NULL, ctx->wc_ctx,
+                                             local_abspath_or_url,
                                              pool, subpool));
       if (copyfrom_url && revision->kind == svn_opt_revision_working)
         {

Modified: subversion/trunk/subversion/libsvn_client/url.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/url.c?rev=937491&r1=937490&r2=937491&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/url.c (original)
+++ subversion/trunk/subversion/libsvn_client/url.c Fri Apr 23 19:55:45 2010
@@ -147,7 +147,7 @@ svn_client__entry_location(const char **
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
 
   SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url, &copyfrom_rev,
-                                         wc_ctx, local_abspath,
+                                         NULL, wc_ctx, local_abspath,
                                          result_pool, scratch_pool));
 
   if (copyfrom_url && peg_rev_kind == svn_opt_revision_working)

Modified: subversion/trunk/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/copy.c?rev=937491&r1=937490&r2=937491&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Fri Apr 23 19:55:45 2010
@@ -349,7 +349,7 @@ copy_file_administratively(svn_wc_contex
     if (src_entry->copied)
       {
         SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url, &copyfrom_rev,
-                                               wc_ctx, src_abspath,
+                                               NULL, wc_ctx, src_abspath,
                                                scratch_pool, scratch_pool));
 
         /* If the COPYFROM information is the SAME as the destination
@@ -691,7 +691,7 @@ copy_dir_administratively(svn_wc_context
                                   svn_node_dir, TRUE,
                                   scratch_pool, scratch_pool));
         SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url, &copyfrom_rev,
-                                               wc_ctx, src_abspath,
+                                               NULL, wc_ctx, src_abspath,
                                                scratch_pool, scratch_pool));
 
         /* If the COPYFROM information is the SAME as the destination

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=937491&r1=937490&r2=937491&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Fri Apr 23 19:55:45 2010
@@ -349,6 +349,7 @@ svn_wc__node_get_url(const char **url,
 svn_error_t *
 svn_wc__node_get_copyfrom_info(const char **copyfrom_url,
                                svn_revnum_t *copyfrom_rev,
+                               svn_boolean_t *is_copy_target,
                                svn_wc_context_t *wc_ctx,
                                const char *local_abspath,
                                apr_pool_t *result_pool,
@@ -360,8 +361,12 @@ svn_wc__node_get_copyfrom_info(const cha
   svn_revnum_t original_revision;
   svn_wc__db_status_t status;
 
-  *copyfrom_url = NULL;
-  *copyfrom_rev = SVN_INVALID_REVNUM;
+  if (copyfrom_url)
+    *copyfrom_url = NULL;
+  if (copyfrom_rev)
+    *copyfrom_rev = SVN_INVALID_REVNUM;
+  if (is_copy_target)
+    *is_copy_target = FALSE;
 
   SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -373,13 +378,18 @@ svn_wc__node_get_copyfrom_info(const cha
     {
       /* If this was the root of the copy then the URL is immediately
          available... */
-      *copyfrom_url = svn_path_url_add_component2(original_root_url,
-                                                  original_repos_relpath,
-                                                  result_pool);
-      *copyfrom_rev = original_revision;
+      if (is_copy_target)
+        *is_copy_target = TRUE;
+      if (copyfrom_url)
+        *copyfrom_url = svn_path_url_add_component2(original_root_url,
+                                                    original_repos_relpath,
+                                                    result_pool);
+      if (copyfrom_rev)
+        *copyfrom_rev = original_revision;
     }
-  else if (status == svn_wc__db_status_added
-           || status == svn_wc__db_status_obstructed_add)
+  else if ((status == svn_wc__db_status_added
+            || status == svn_wc__db_status_obstructed_add)
+           && (copyfrom_rev || copyfrom_url))
     {
       /* ...But if this is merely the descendant of an explicitly
          copied/moved directory, we need to do a bit more work to
@@ -404,10 +414,12 @@ svn_wc__node_get_copyfrom_info(const cha
                                             scratch_pool);
           if (src_relpath)
             {
-              *copyfrom_url = svn_path_url_add_component2(src_parent_url,
-                                                          src_relpath,
-                                                          result_pool);
-              *copyfrom_rev = original_revision;
+              if (copyfrom_url)
+                *copyfrom_url = svn_path_url_add_component2(src_parent_url,
+                                                            src_relpath,
+                                                            result_pool);
+              if (copyfrom_rev)
+                *copyfrom_rev = original_revision;
             }
         }
     }