subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1830900 - in /subversion/trunk/subversion: libsvn_client/update.c tests/cmdline/externals_tests.py
Date Fri, 04 May 2018 09:11:12 GMT
Author: stsp
Date: Fri May  4 09:11:12 2018
New Revision: 1830900

URL: http://svn.apache.org/viewvc?rev=1830900&view=rev
Log:
Prune externals from excluded subtrees after 'update --set-depth=exclude'.

* subversion/libsvn_client/update.c
  (handle_externals, reuse_ra_session): New helpers, extracted from ....
  (update_internal): ... here. Use the new helpers to prune externals
   after excluding a subtree from the working copy, as is already done
   for other update operations which result in a shallower ambient depth.

* subversion/tests/cmdline/externals_tests.py
  (update_dir_external_exclude): Remove XFail marker.

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

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1830900&r1=1830899&r2=1830900&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Fri May  4 09:11:12 2018
@@ -182,6 +182,88 @@ record_conflict(svn_wc_conflict_result_t
   return SVN_NO_ERROR;
 }
 
+/* Perform post-update processing of externals defined below LOCAL_ABSPATH. */
+static svn_error_t *
+handle_externals(svn_boolean_t *timestamp_sleep,
+                 const char *local_abspath,
+                 svn_depth_t depth,
+                 const char *repos_root_url,
+                 svn_ra_session_t *ra_session,
+                 svn_client_ctx_t *ctx,
+                 apr_pool_t *scratch_pool)
+{
+  apr_hash_t *new_externals;
+  apr_hash_t *new_depths;
+
+  SVN_ERR(svn_wc__externals_gather_definitions(&new_externals,
+                                               &new_depths,
+                                               ctx->wc_ctx, local_abspath,
+                                               depth,
+                                               scratch_pool, scratch_pool));
+
+  SVN_ERR(svn_client__handle_externals(new_externals,
+                                       new_depths,
+                                       repos_root_url, local_abspath,
+                                       depth, timestamp_sleep, ra_session,
+                                       ctx, scratch_pool));
+  return SVN_NO_ERROR;
+}
+
+/* Try to reuse the RA session by reparenting it to the anchor_url.
+ * This code is probably overly cautious since we only use this
+ * currently when parents are missing and so all the anchor_urls
+ * have to be in the same repo.
+ * Note that ra_session_p is an (optional) input parameter as well
+ * as an output parameter. */
+static svn_error_t *
+reuse_ra_session(svn_ra_session_t **ra_session_p,
+                 const char **corrected_url,
+                 const char *anchor_url,
+                 const char *anchor_abspath,
+                 svn_client_ctx_t *ctx,
+                 apr_pool_t *result_pool,
+                 apr_pool_t *scratch_pool)
+{
+  svn_ra_session_t *ra_session = *ra_session_p;
+
+  if (ra_session)
+    {
+      svn_error_t *err = svn_ra_reparent(ra_session, anchor_url, scratch_pool);
+      if (err)
+        {
+          if (err->apr_err == SVN_ERR_RA_ILLEGAL_URL)
+            {
+            /* session changed repos, can't reuse it */
+              svn_error_clear(err);
+              ra_session = NULL;
+            }
+          else
+            {
+              return svn_error_trace(err);
+            }
+        }
+      else
+        {
+          *corrected_url = NULL;
+        }
+    }
+
+  /* Open an RA session for the URL if one isn't already available */
+  if (!ra_session)
+    {
+      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, corrected_url,
+                                                   anchor_url,
+                                                   anchor_abspath, NULL,
+                                                   TRUE /* write_dav_props */,
+                                                   TRUE /* read_dav_props */,
+                                                   ctx,
+                                                   result_pool, scratch_pool));
+      *ra_session_p = ra_session;
+    }
+
+  return SVN_NO_ERROR;
+}
+
 /* This is a helper for svn_client__update_internal(), which see for
    an explanation of most of these parameters.  Some stuff that's
    unique is as follows:
@@ -320,6 +402,18 @@ update_internal(svn_revnum_t *result_rev
                                  ctx->notify_func2, ctx->notify_baton2,
                                  scratch_pool));
 
+          if (!ignore_externals)
+            {
+              /* We may now be able to remove externals below LOCAL_ABSPATH. */
+              SVN_ERR(reuse_ra_session(ra_session_p, &corrected_url,
+                                       anchor_url, anchor_abspath,
+                                       ctx, result_pool, scratch_pool));
+              ra_session = *ra_session_p;
+              SVN_ERR(handle_externals(timestamp_sleep, local_abspath, depth,
+                                       repos_root_url, ra_session, ctx,
+                                       scratch_pool));
+            }
+
           /* Target excluded, we are done now */
           return SVN_NO_ERROR;
         }
@@ -377,40 +471,9 @@ update_internal(svn_revnum_t *result_rev
    * This code is probably overly cautious since we only use this
    * currently when parents are missing and so all the anchor_urls
    * have to be in the same repo. */
-  if (ra_session)
-    {
-      svn_error_t *err = svn_ra_reparent(ra_session, anchor_url, scratch_pool);
-      if (err)
-        {
-          if (err->apr_err == SVN_ERR_RA_ILLEGAL_URL)
-            {
-            /* session changed repos, can't reuse it */
-              svn_error_clear(err);
-              ra_session = NULL;
-            }
-          else
-            {
-              return svn_error_trace(err);
-            }
-        }
-      else
-        {
-          corrected_url = NULL;
-        }
-    }
-
-  /* Open an RA session for the URL if one isn't already available */
-  if (!ra_session)
-    {
-      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, &corrected_url,
-                                                   anchor_url,
-                                                   anchor_abspath, NULL,
-                                                   TRUE /* write_dav_props */,
-                                                   TRUE /* read_dav_props */,
-                                                   ctx,
-                                                   result_pool, scratch_pool));
-      *ra_session_p = ra_session;
-    }
+  SVN_ERR(reuse_ra_session(ra_session_p, &corrected_url, anchor_url,
+                           anchor_abspath, ctx, result_pool, scratch_pool));
+  ra_session = *ra_session_p;
 
   /* If we got a corrected URL from the RA subsystem, we'll need to
      relocate our working copy first. */
@@ -513,19 +576,8 @@ update_internal(svn_revnum_t *result_rev
   if ((SVN_DEPTH_IS_RECURSIVE(depth) || cropping_target)
       && (! ignore_externals))
     {
-      apr_hash_t *new_externals;
-      apr_hash_t *new_depths;
-      SVN_ERR(svn_wc__externals_gather_definitions(&new_externals,
-                                                   &new_depths,
-                                                   ctx->wc_ctx, local_abspath,
-                                                   depth,
-                                                   scratch_pool, scratch_pool));
-
-      SVN_ERR(svn_client__handle_externals(new_externals,
-                                           new_depths,
-                                           repos_root_url, local_abspath,
-                                           depth, timestamp_sleep, ra_session,
-                                           ctx, scratch_pool));
+      SVN_ERR(handle_externals(timestamp_sleep, local_abspath, depth,
+                               repos_root_url, ra_session, ctx, scratch_pool));
     }
 
   /* Let everyone know we're finished here (unless we're asked not to). */

Modified: subversion/trunk/subversion/tests/cmdline/externals_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/externals_tests.py?rev=1830900&r1=1830899&r2=1830900&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/externals_tests.py Fri May  4 09:11:12 2018
@@ -4400,7 +4400,6 @@ def invalid_uris_in_repo(sbox):
 
 # Like issue #3741 'externals not removed when working copy is made shallow'
 # but with --set-depth=exclude instead of --set-depth=empty.
-@XFail()
 def update_dir_external_exclude(sbox):
   "exclude update should remove externals"
 



Mime
View raw message