You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/01/22 15:23:46 UTC

svn commit: r902093 - in /subversion/trunk/subversion: libsvn_client/externals.c libsvn_client/switch.c tests/cmdline/externals_tests.py

Author: stsp
Date: Fri Jan 22 14:23:45 2010
New Revision: 902093

URL: http://svn.apache.org/viewvc?rev=902093&view=rev
Log:
Fix issue #3390, relative externals not updated during switch. As a side
effect - allow externals hash diff functionality to be used with abspaths.

* subversion/libsvn_client/switch.c
  (svn_client__switch_internal): Pass in an external_func to
    svn_wc_crawl_revision5().

* subversion/libsvn_client/externals.c
  (handle_externals_desc_change): Get the url for parent_dir with
    svn_wc__node_get_url(). Does not work for export where the
    parent_dir has no url. Then we resort to the old way of adding the
    parent_dir to the from_url.

* subversion/tests/cmdline/externals_tests.py
  (test_list): Remove XFail from switch_relative_external.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
Review by: stsp
           philip (older version)

Modified:
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/switch.c
    subversion/trunk/subversion/tests/cmdline/externals_tests.py

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=902093&r1=902092&r2=902093&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Fri Jan 22 14:23:45 2010
@@ -1089,6 +1089,9 @@
   svn_wc_external_item2_t *item;
   const char *ambient_depth_w;
   svn_depth_t ambient_depth;
+  const char *url;
+  const char *abs_parent_dir;
+  svn_error_t *err;
 
   if (cb->is_export)
     SVN_ERR_ASSERT(!cb->adm_access);
@@ -1166,18 +1169,38 @@
   ib.pool              = cb->pool;
   ib.iter_pool         = svn_pool_create(cb->pool);
 
-  /* Get the URL of the parent directory by appending a portion of
-     parent_dir to from_url.  from_url is the URL for to_path and
-     to_path is a substring of parent_dir, so append any characters in
-     parent_dir past strlen(to_path) to from_url (making sure to move
-     past a '/' in parent_dir, otherwise svn_path_url_add_component()
-     will error. */
-  len = strlen(cb->to_path);
-  if (ib.parent_dir[len] == '/')
-    ++len;
-  ib.parent_dir_url = svn_path_url_add_component2(cb->from_url,
-                                                  ib.parent_dir + len,
-                                                  cb->pool);
+  SVN_ERR(svn_dirent_get_absolute(&abs_parent_dir, ib.parent_dir, 
+                                  cb->pool));
+
+  err = svn_wc__node_get_url(&url, cb->ctx->wc_ctx, 
+                             abs_parent_dir, cb->pool, cb->pool);
+
+  /* If we're doing an 'svn export' the current dir will not be a 
+     working copy. We can't get the parent_dir. */
+  if (err)
+    {
+      if (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY ||
+          err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+        {
+          /* Get the URL of the parent directory by appending a portion of
+             parent_dir to from_url.  from_url is the URL for to_path and
+             to_path is a substring of parent_dir, so append any characters in
+             parent_dir past strlen(to_path) to from_url (making sure to move
+             past a '/' in parent_dir, otherwise svn_path_url_add_component()
+             will error. */
+          len = strlen(cb->to_path);
+          if (ib.parent_dir[len] == '/')
+            ++len;
+          ib.parent_dir_url = svn_path_url_add_component2(cb->from_url,
+                                                          ib.parent_dir + len,
+                                                          cb->pool);
+          svn_error_clear(err);
+        }
+      else 
+        return svn_error_return(err);
+    }
+  else
+      ib.parent_dir_url = url;
 
   /* We must use a custom version of svn_hash_diff so that the diff
      entries are processed in the order they were originally specified

Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=902093&r1=902092&r2=902093&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Fri Jan 22 14:23:45 2010
@@ -256,13 +256,15 @@
      PATH.  When we call reporter->finish_report, the update_editor
      will be driven by svn_repos_dir_delta2.
 
-     We pass NULL for traversal_info because this is a switch, not an
-     update, and therefore we don't want to handle any externals
-     except the ones directly affected by the switch. */
+     We pass in an external_func for recording all externals. It
+     shouldn't be needed for a switch if it wasn't for the relative
+     externals of type '../path'. All of those must be resolved to 
+     the new location.  */
   err = svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath, reporter,
                                 report_baton, TRUE, depth, (! depth_is_sticky),
                                 (! server_supports_depth),
-                                use_commit_times, NULL, NULL,
+                                use_commit_times, 
+                                svn_client__external_info_gatherer, &efb,
                                 ctx->notify_func2, ctx->notify_baton2, pool);
 
   if (err)

Modified: subversion/trunk/subversion/tests/cmdline/externals_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/externals_tests.py?rev=902093&r1=902092&r2=902093&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/externals_tests.py Fri Jan 22 14:23:45 2010
@@ -1583,7 +1583,7 @@
               external_into_path_with_spaces,
               binary_file_externals,
               XFail(update_lose_file_external),
-              XFail(switch_relative_external),
+              switch_relative_external,
               export_sparse_wc_with_externals,
               relegate_external,
               wc_repos_file_externals,