You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2014/12/01 05:01:21 UTC

svn commit: r1642633 - in /subversion/branches/1.8.x: ./ STATUS subversion/libsvn_client/upgrade.c

Author: svn-role
Date: Mon Dec  1 04:01:21 2014
New Revision: 1642633

URL: http://svn.apache.org/r1642633
Log:
Merge the 1.8.x-r1625533 branch:

 * r1625533, r1625537
   Keep externals registrations on 'svn upgrade' (part of issue 4519)
   Justification:
     'svn upgrade' shouldn't destroy valid information.
   Branch:
     ^/subversion/branches/1.8.x-r1625533
   Votes:
     +1: rhuijben, philip, stefan2

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_client/upgrade.c

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/branches/1.8.x-r1625533:r1640743-1642632
  Merged /subversion/trunk:r1625533,1625537

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1642633&r1=1642632&r2=1642633&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Mon Dec  1 04:01:21 2014
@@ -108,15 +108,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1625533, r1625537
-   Keep externals registrations on 'svn upgrade' (part of issue 4519)
-   Justification:
-     'svn upgrade' shouldn't destroy valid information.
-   Branch:
-     ^/subversion/branches/1.8.x-r1625533
-   Votes:
-     +1: rhuijben, philip, stefan2
-
  * r1633126
    Improve performance of recorded timestamp fixups in svn cleanup
    Justification:
@@ -135,4 +126,3 @@ Approved changes:
      ^/subversion/branches/1.8.x-r1641564
    Votes:
      +1: philip, rhuijben, stefan2
-

Modified: subversion/branches/1.8.x/subversion/libsvn_client/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_client/upgrade.c?rev=1642633&r1=1642632&r2=1642633&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_client/upgrade.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_client/upgrade.c Mon Dec  1 04:01:21 2014
@@ -82,6 +82,14 @@ fetch_repos_info(const char **repos_root
   return SVN_NO_ERROR;
 }
 
+/* Forward definition. Upgrades svn:externals properties in the working copy
+   LOCAL_ABSPATH to the WC-NG  storage.
+ */
+static svn_error_t *
+upgrade_externals_from_properties(svn_client_ctx_t *ctx,
+                                  const char *local_abspath,
+                                  apr_pool_t *scratch_pool);
+
 svn_error_t *
 svn_client_upgrade(const char *path,
                    svn_client_ctx_t *ctx,
@@ -89,10 +97,6 @@ svn_client_upgrade(const char *path,
 {
   const char *local_abspath;
   apr_hash_t *externals;
-  apr_hash_index_t *hi;
-  apr_pool_t *iterpool;
-  apr_pool_t *iterpool2;
-  svn_opt_revision_t rev = {svn_opt_revision_unspecified, {0}};
   struct repos_info_baton info_baton;
 
   info_baton.state_pool = scratch_pool;
@@ -111,6 +115,80 @@ svn_client_upgrade(const char *path,
                          ctx->notify_func2, ctx->notify_baton2,
                          scratch_pool));
 
+  SVN_ERR(svn_wc__externals_defined_below(&externals,
+                                          ctx->wc_ctx, local_abspath,
+                                          scratch_pool, scratch_pool));
+
+  if (apr_hash_count(externals) > 0)
+    {
+      apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+      apr_hash_index_t *hi;
+
+      /* We are upgrading from >= 1.7. No need to upgrade from
+         svn:externals properties. And by that avoiding the removal
+         of recorded externals information (issue #4519)
+
+         Only directory externals need an explicit upgrade */
+      for (hi = apr_hash_first(scratch_pool, externals);
+           hi;
+           hi = apr_hash_next(hi))
+        {
+          const char *ext_abspath;
+          svn_node_kind_t kind;
+
+          svn_pool_clear(iterpool);
+
+          ext_abspath = svn__apr_hash_index_key(hi);
+
+          SVN_ERR(svn_wc__read_external_info(&kind, NULL, NULL, NULL, NULL,
+                                             ctx->wc_ctx, local_abspath,
+                                             ext_abspath, FALSE,
+                                             iterpool, iterpool));
+
+          if (kind == svn_node_dir)
+            {
+              svn_error_t *err = svn_client_upgrade(ext_abspath, ctx, iterpool);
+
+              if (err)
+                {
+                  svn_wc_notify_t *notify =
+                            svn_wc_create_notify(ext_abspath,
+                                                 svn_wc_notify_failed_external,
+                                                 iterpool);
+                  notify->err = err;
+                  ctx->notify_func2(ctx->notify_baton2,
+                                    notify, iterpool);
+                  svn_error_clear(err);
+                  /* Next external node, please... */
+                }
+            }
+        }
+
+      svn_pool_destroy(iterpool);
+    }
+  else
+    {
+      /* Upgrading from <= 1.6, or no svn:properties defined.
+         (There is no way to detect the difference from libsvn_client :( ) */
+
+      SVN_ERR(upgrade_externals_from_properties(ctx, local_abspath,
+                                                scratch_pool));
+    }
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+upgrade_externals_from_properties(svn_client_ctx_t *ctx,
+                                  const char *local_abspath,
+                                  apr_pool_t *scratch_pool)
+{
+  apr_hash_index_t *hi;
+  apr_pool_t *iterpool;
+  apr_pool_t *iterpool2;
+  apr_hash_t *externals;
+  svn_opt_revision_t rev = {svn_opt_revision_unspecified, {0}};
+  struct repos_info_baton info_baton;
+
   /* Now it's time to upgrade the externals too. We do it after the wc
      upgrade to avoid that errors in the externals causes the wc upgrade to
      fail. Thanks to caching the performance penalty of walking the wc a
@@ -163,7 +241,7 @@ svn_client_upgrade(const char *path,
                                     iterpool);
       if (!err)
         err = svn_wc_parse_externals_description3(
-                  &externals_p, svn_dirent_dirname(path, iterpool),
+                  &externals_p, svn_dirent_dirname(local_abspath, iterpool),
                   external_desc->data, FALSE, iterpool);
       if (err)
         {