subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1847834 - in /subversion/trunk/subversion: include/private/svn_client_private.h libsvn_client/conflicts.c libsvn_client/copy.c libsvn_client/wc_editor.c tests/cmdline/externals_tests.py
Date Fri, 30 Nov 2018 16:02:43 GMT
Author: julianfoad
Date: Fri Nov 30 16:02:43 2018
New Revision: 1847834

URL: http://svn.apache.org/viewvc?rev=1847834&view=rev
Log:
Unify how 'copy' processes externals with and without pinning.

For issue #4786 "Create a WC working-mods editor".

Remove the optional 'externals' processing from inside the
'repos_to_wc_copy' API.  Previously, externals were fetched outside the
'copy' API if and only if some externals were to be pinned. Now we always
use that code path.

As a side effect, this makes the notifications consistent between the two
cases.

* subversion/include/private/svn_client_private.h
  (svn_client__repos_to_wc_copy): Remove 'externals' options.

* subversion/libsvn_client/copy.c
  (svn_client__repos_to_wc_copy_dir,
   svn_client__repos_to_wc_copy): Remove 'externals' option.
  (repos_to_wc_copy_single): Always fetch externals after the copy.

* subversion/libsvn_client/conflicts.c
  (merge_incoming_added_dir_replace): Trivially update this caller.

* subversion/libsvn_client/wc_editor.c
  (dir_add,
   file_add): Trivially update these callers.

* subversion/tests/cmdline/externals_tests.py
  (url_to_wc_copy_of_externals): Revert the changes to the expected
    notifications that were introduced by r1847206.

Modified:
    subversion/trunk/subversion/include/private/svn_client_private.h
    subversion/trunk/subversion/libsvn_client/conflicts.c
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_client/wc_editor.c
    subversion/trunk/subversion/tests/cmdline/externals_tests.py

Modified: subversion/trunk/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_client_private.h?rev=1847834&r1=1847833&r2=1847834&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Fri Nov 30 16:02:43 2018
@@ -427,6 +427,9 @@ svn_client__get_diff_summarize_callbacks
  *
  * Use RA_SESSION to fetch the data. The session may point to a different
  * URL after returning.
+ *
+ * This API does not process any externals definitions that may be present
+ * on copied directories.
  */
 svn_error_t *
 svn_client__repos_to_wc_copy(svn_boolean_t *timestamp_sleep,
@@ -434,7 +437,6 @@ svn_client__repos_to_wc_copy(svn_boolean
                              const char *src_url,
                              svn_revnum_t src_rev,
                              const char *dst_abspath,
-                             svn_boolean_t ignore_externals,
                              svn_boolean_t same_repositories,
                              svn_ra_session_t *ra_session,
                              svn_client_ctx_t *ctx,

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1847834&r1=1847833&r2=1847834&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Fri Nov 30 16:02:43 2018
@@ -8045,7 +8045,6 @@ merge_incoming_added_dir_replace(svn_cli
                                      svn_node_dir,
                                      url, incoming_new_pegrev,
                                      local_abspath,
-                                     TRUE, /* we want to ignore externals */
                                      TRUE /*same_repositories*/,
                                      ra_session, ctx, scratch_pool);
   if (err)

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1847834&r1=1847833&r2=1847834&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Fri Nov 30 16:02:43 2018
@@ -2360,7 +2360,6 @@ svn_client__repos_to_wc_copy_dir(svn_boo
                                  const char *src_url,
                                  svn_revnum_t src_revnum,
                                  const char *dst_abspath,
-                                 svn_boolean_t ignore_externals,
                                  svn_boolean_t same_repositories,
                                  svn_ra_session_t *ra_session,
                                  svn_client_ctx_t *ctx,
@@ -2427,7 +2426,7 @@ svn_client__repos_to_wc_copy_dir(svn_boo
                                         &copy_src_revision,
                                         &copy_src_revision,
                                         svn_depth_infinity,
-                                        ignore_externals,
+                                        TRUE /*ignore_externals*/,
                                         FALSE, /* we don't allow obstructions */
                                         ra_session, ctx, scratch_pool);
 
@@ -2514,7 +2513,6 @@ svn_client__repos_to_wc_copy(svn_boolean
                              const char *src_url,
                              svn_revnum_t src_rev,
                              const char *dst_abspath,
-                             svn_boolean_t ignore_externals,
                              svn_boolean_t same_repositories,
                              svn_ra_session_t *ra_session,
                              svn_client_ctx_t *ctx,
@@ -2525,7 +2523,6 @@ svn_client__repos_to_wc_copy(svn_boolean
       SVN_ERR(svn_client__repos_to_wc_copy_dir(timestamp_sleep,
                                                src_url, src_rev,
                                                dst_abspath,
-                                               ignore_externals,
                                                same_repositories,
                                                ra_session,
                                                ctx, scratch_pool));
@@ -2581,61 +2578,59 @@ repos_to_wc_copy_single(svn_boolean_t *t
         SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
     }
 
-  /* Avoid a chicken-and-egg problem:
-   * If pinning externals we'll need to adjust externals
-   * properties before checking out any externals.
-   * But copy needs to happen before pinning because else there
-   * are no svn:externals properties to pin. */
-  if (pin_externals)
-    ignore_externals = TRUE;
-
   SVN_ERR(svn_client__repos_to_wc_copy(timestamp_sleep,
                                        pair->src_kind,
                                        pair->src_abspath_or_url,
                                        pair->src_revnum,
                                        dst_abspath,
-                                       ignore_externals,
                                        same_repositories,
                                        ra_session, ctx, pool));
 
-  if (pair->src_kind == svn_node_dir)
+  /* Fetch externals, pinning them if requested */
+  if (!ignore_externals && pair->src_kind == svn_node_dir)
     {
-      if (same_repositories && pin_externals)
+      if (same_repositories)
         {
-          apr_hash_t *pinned_externals;
-          apr_hash_index_t *hi;
-          apr_pool_t *iterpool;
           const char *repos_root_url;
           apr_hash_t *new_externals;
           apr_hash_t *new_depths;
 
           SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root_url, pool));
-          SVN_ERR(resolve_pinned_externals(&pinned_externals,
-                                           externals_to_pin, pair,
-                                           ra_session, repos_root_url,
-                                           ctx, pool, pool));
-
-          iterpool = svn_pool_create(pool);
-          for (hi = apr_hash_first(pool, pinned_externals);
-               hi;
-               hi = apr_hash_next(hi))
+
+          if (pin_externals)
             {
-              const char *dst_relpath = apr_hash_this_key(hi);
-              svn_string_t *externals_propval = apr_hash_this_val(hi);
-              const char *local_abspath;
-
-              svn_pool_clear(iterpool);
-
-              local_abspath = svn_dirent_join(pair->dst_abspath_or_url,
-                                              dst_relpath, iterpool);
-              /* ### use a work queue? */
-              SVN_ERR(svn_wc_prop_set4(ctx->wc_ctx, local_abspath,
-                                       SVN_PROP_EXTERNALS, externals_propval,
-                                       svn_depth_empty, TRUE /* skip_checks */,
-                                       NULL  /* changelist_filter */,
-                                       ctx->cancel_func, ctx->cancel_baton,
-                                       NULL, NULL, /* no extra notification */
-                                       iterpool));
+              apr_hash_t *pinned_externals;
+              apr_hash_index_t *hi;
+              apr_pool_t *iterpool;
+
+              SVN_ERR(resolve_pinned_externals(&pinned_externals,
+                                               externals_to_pin, pair,
+                                               ra_session, repos_root_url,
+                                               ctx, pool, pool));
+
+              iterpool = svn_pool_create(pool);
+              for (hi = apr_hash_first(pool, pinned_externals);
+                   hi;
+                   hi = apr_hash_next(hi))
+                {
+                  const char *dst_relpath = apr_hash_this_key(hi);
+                  svn_string_t *externals_propval = apr_hash_this_val(hi);
+                  const char *local_abspath;
+
+                  svn_pool_clear(iterpool);
+
+                  local_abspath = svn_dirent_join(pair->dst_abspath_or_url,
+                                                  dst_relpath, iterpool);
+                  /* ### use a work queue? */
+                  SVN_ERR(svn_wc_prop_set4(ctx->wc_ctx, local_abspath,
+                                           SVN_PROP_EXTERNALS, externals_propval,
+                                           svn_depth_empty, TRUE /* skip_checks */,
+                                           NULL  /* changelist_filter */,
+                                           ctx->cancel_func, ctx->cancel_baton,
+                                           NULL, NULL, /* no extra notification */
+                                           iterpool));
+                }
+              svn_pool_destroy(iterpool);
             }
 
           /* Now update all externals in the newly created copy. */
@@ -2644,15 +2639,14 @@ repos_to_wc_copy_single(svn_boolean_t *t
                                                        ctx->wc_ctx,
                                                        dst_abspath,
                                                        svn_depth_infinity,
-                                                       iterpool, iterpool));
+                                                       pool, pool));
           SVN_ERR(svn_client__handle_externals(new_externals,
                                                new_depths,
                                                repos_root_url, dst_abspath,
                                                svn_depth_infinity,
                                                timestamp_sleep,
                                                ra_session,
-                                               ctx, iterpool));
-          svn_pool_destroy(iterpool);
+                                               ctx, pool));
         }
     }
 

Modified: subversion/trunk/subversion/libsvn_client/wc_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/wc_editor.c?rev=1847834&r1=1847833&r2=1847834&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/wc_editor.c (original)
+++ subversion/trunk/subversion/libsvn_client/wc_editor.c Fri Nov 30 16:02:43 2018
@@ -258,7 +258,6 @@ dir_add(const char *path,
                                            copyfrom_path,
                                            copyfrom_revision,
                                            db->local_abspath,
-                                           TRUE /*ignore_externals*/,
                                            same_repository,
                                            db->eb->ra_session,
                                            db->eb->ctx, db->pool));
@@ -449,7 +448,6 @@ file_add(const char *path,
                                            copyfrom_path,
                                            copyfrom_revision,
                                            fb->local_abspath,
-                                           TRUE /*ignore_externals*/,
                                            same_repository,
                                            fb->eb->ra_session,
                                            fb->eb->ctx, fb->pool));

Modified: subversion/trunk/subversion/tests/cmdline/externals_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/externals_tests.py?rev=1847834&r1=1847833&r2=1847834&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/externals_tests.py Fri Nov 30 16:02:43 2018
@@ -2949,10 +2949,11 @@ def url_to_wc_copy_of_externals(sbox):
     "A         " + external_root_path + "\n",
     "\n",
     "Fetching external item into '" + external_ex_path + "':\n",
-    "A         " + external_ex_path + "\n",
-    "A         " + external_pi_path + "\n",
-    "A         " + external_rho_path + "\n",
-    "A         " + external_tau_path + "\n",
+    "A    " + external_pi_path + "\n",
+    "A    " + external_rho_path + "\n",
+    "A    " + external_tau_path + "\n",
+    "Checked out external at revision 2.\n",
+    "\n",
   ])
   exit_code, stdout, stderr = svntest.actions.run_and_verify_svn2(
     expected_stdout, [], 0, 'copy', repo_url + '/A/C',



Mime
View raw message