subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svn-r...@apache.org
Subject svn commit: r1835702 - in /subversion/branches/1.10.x: ./ STATUS subversion/libsvn_client/update.c subversion/tests/cmdline/externals_tests.py
Date Thu, 12 Jul 2018 04:00:12 GMT
Author: svn-role
Date: Thu Jul 12 04:00:11 2018
New Revision: 1835702

URL: http://svn.apache.org/viewvc?rev=1835702&view=rev
Log:
Merge the r1830883 group from trunk:

 * r1830883,r1830900,r1830901
   Prune externals from excluded subtrees after 'update --set-depth=exclude'
   Justification:
     Current behaviour is inconsistent: Setting depth to 'empty' prunes
     externals while excluding a subtree does not.
   Votes:
     +1: stsp, philip, jcorvel
     +0: rhuijben (in concept, not reviewed)

Modified:
    subversion/branches/1.10.x/   (props changed)
    subversion/branches/1.10.x/STATUS
    subversion/branches/1.10.x/subversion/libsvn_client/update.c
    subversion/branches/1.10.x/subversion/tests/cmdline/externals_tests.py

Propchange: subversion/branches/1.10.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 12 04:00:11 2018
@@ -101,4 +101,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1817837,1817856,1818577-1818578,1818584,1818651,1818662,1818727,1818801,1818803,1818807,1818868,1818871,1819036-1819037,1819043,1819049,1819052,1819093,1819146,1819162,1819444,1819556-1819557,1819603,1819804,1819911,1820044,1820046-1820047,1820518,1820627,1820718,1820778,1821183,1821224,1821621,1821678,1822401,1822587,1822591,1822996,1823202-1823203,1823211,1823327,1823791,1823966,1823989,1824033,1825024,1825045,1825215,1825266,1825306,1825709,1825711,1825721,1825736,1825778,1825783,1825787-1825788,1825979,1826720-1826721,1826747,1826811,1826814,1826877,1826907,1826971,1827105,1827114,1827191,1827562,1827574,1827670,1828613,1829012,1829015,1829241,1829260,1829344,1830885,1831110,1831112,1831540,1833621
+/subversion/trunk:1817837,1817856,1818577-1818578,1818584,1818651,1818662,1818727,1818801,1818803,1818807,1818868,1818871,1819036-1819037,1819043,1819049,1819052,1819093,1819146,1819162,1819444,1819556-1819557,1819603,1819804,1819911,1820044,1820046-1820047,1820518,1820627,1820718,1820778,1821183,1821224,1821621,1821678,1822401,1822587,1822591,1822996,1823202-1823203,1823211,1823327,1823791,1823966,1823989,1824033,1825024,1825045,1825215,1825266,1825306,1825709,1825711,1825721,1825736,1825778,1825783,1825787-1825788,1825979,1826720-1826721,1826747,1826811,1826814,1826877,1826907,1826971,1827105,1827114,1827191,1827562,1827574,1827670,1828613,1829012,1829015,1829241,1829260,1829344,1830883,1830885,1830900-1830901,1831110,1831112,1831540,1833621

Modified: subversion/branches/1.10.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.10.x/STATUS?rev=1835702&r1=1835701&r2=1835702&view=diff
==============================================================================
--- subversion/branches/1.10.x/STATUS (original)
+++ subversion/branches/1.10.x/STATUS Thu Jul 12 04:00:11 2018
@@ -71,15 +71,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1830883,r1830900,r1830901
-   Prune externals from excluded subtrees after 'update --set-depth=exclude'
-   Justification:
-     Current behaviour is inconsistent: Setting depth to 'empty' prunes
-     externals while excluding a subtree does not.
-   Votes:
-     +1: stsp, philip, jcorvel
-     +0: rhuijben (in concept, not reviewed)
-
  * r1833836, r1833842
    Fix issue #4740, "conflict resolver searches too far back ..."
    Justification:

Modified: subversion/branches/1.10.x/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.10.x/subversion/libsvn_client/update.c?rev=1835702&r1=1835701&r2=1835702&view=diff
==============================================================================
--- subversion/branches/1.10.x/subversion/libsvn_client/update.c (original)
+++ subversion/branches/1.10.x/subversion/libsvn_client/update.c Thu Jul 12 04:00:11 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;
         }
@@ -373,44 +467,9 @@ update_internal(svn_revnum_t *result_rev
       ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
     }
 
-  /* 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. */
-  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 +572,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/branches/1.10.x/subversion/tests/cmdline/externals_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.10.x/subversion/tests/cmdline/externals_tests.py?rev=1835702&r1=1835701&r2=1835702&view=diff
==============================================================================
--- subversion/branches/1.10.x/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/branches/1.10.x/subversion/tests/cmdline/externals_tests.py Thu Jul 12 04:00:11
2018
@@ -4398,6 +4398,45 @@ def invalid_uris_in_repo(sbox):
                                             "-r", revision)
     svntest.main.safe_rmtree(sbox.wc_dir)
 
+# Like issue #3741 'externals not removed when working copy is made shallow'
+# but with --set-depth=exclude instead of --set-depth=empty.
+def update_dir_external_exclude(sbox):
+  "exclude update should remove externals"
+
+  sbox.build()
+
+  # Create an external in r2
+  sbox.simple_propset('svn:externals', '^/A/D/H X', 'A/B/E')
+  sbox.simple_commit()
+  sbox.simple_update()
+
+  # Now make A/B/E shallow by updating with "--set-depth exclude"
+  expected_output = svntest.wc.State(sbox.wc_dir, {
+    'A/B/E'       : Item(status='D '),
+    'A/B/E/X'     : Item(verb='Removed external'),
+  })
+  svntest.actions.run_and_verify_update(sbox.wc_dir,
+                                        expected_output, None, None,
+                                        [], False,
+                                        '--set-depth=exclude',
+                                        sbox.ospath('A/B/E'))
+
+  # And bring the external back by updating with "--set-depth infinity"
+  expected_output = svntest.wc.State(sbox.wc_dir, {
+    'A/B/E'         : Item(status='A '),
+    'A/B/E/alpha'   : Item(status='A '),
+    'A/B/E/beta'    : Item(status='A '),
+    'A/B/E/X/chi'   : Item(status='A '),
+    'A/B/E/X/omega' : Item(status='A '),
+    'A/B/E/X/psi'   : Item(status='A '),
+  })
+  svntest.actions.run_and_verify_update(sbox.wc_dir,
+                                        expected_output, None, None,
+                                        [], False,
+                                        '--set-depth=infinity',
+                                        sbox.ospath('A/B/E'))
+
+
 ########################################################################
 # Run the tests
 
@@ -4474,6 +4513,7 @@ test_list = [ None,
               file_external_recorded_info,
               external_externally_removed,
               invalid_uris_in_repo,
+              update_dir_external_exclude,
              ]
 
 if __name__ == '__main__':



Mime
View raw message