You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2014/04/17 23:59:25 UTC

svn commit: r1588384 - in /subversion/branches/1.8.x-r1580626: ./ subversion/libsvn_wc/wc_db.c subversion/tests/libsvn_wc/op-depth-test.c subversion/tests/libsvn_wc/utils.c subversion/tests/libsvn_wc/utils.h

Author: rhuijben
Date: Thu Apr 17 21:59:25 2014
New Revision: 1588384

URL: http://svn.apache.org/r1588384
Log:
Merge the valid revisions from the old branch to the recreated branch

Modified:
    subversion/branches/1.8.x-r1580626/   (props changed)
    subversion/branches/1.8.x-r1580626/subversion/libsvn_wc/wc_db.c
    subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/op-depth-test.c
    subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.c
    subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.h

Propchange: subversion/branches/1.8.x-r1580626/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1580626,1580650,1581430
  Merged /subversion/branches/1.8.x-r1580626:r1580631,1580652,1580661,1581435

Modified: subversion/branches/1.8.x-r1580626/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x-r1580626/subversion/libsvn_wc/wc_db.c?rev=1588384&r1=1588383&r2=1588384&view=diff
==============================================================================
--- subversion/branches/1.8.x-r1580626/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/1.8.x-r1580626/subversion/libsvn_wc/wc_db.c Thu Apr 17 21:59:25 2014
@@ -4076,8 +4076,9 @@ get_info_for_copy(apr_int64_t *copyfrom_
                   svn_wc__db_status_t *status,
                   svn_node_kind_t *kind,
                   svn_boolean_t *op_root,
-                  svn_wc__db_wcroot_t *wcroot,
+                  svn_wc__db_wcroot_t *src_wcroot,
                   const char *local_relpath,
+                  svn_wc__db_wcroot_t *dst_wcroot,
                   apr_pool_t *result_pool,
                   apr_pool_t *scratch_pool)
 {
@@ -4094,7 +4095,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
                     NULL /* have_base */,
                     NULL /* have_more_work */,
                     NULL /* have_work */,
-                    wcroot, local_relpath, result_pool, scratch_pool));
+                    src_wcroot, local_relpath, result_pool, scratch_pool));
 
   if (op_root)
     *op_root = is_op_root;
@@ -4109,7 +4110,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
                        scratch_pool);
       SVN_ERR(get_info_for_copy(copyfrom_id, copyfrom_relpath, copyfrom_rev,
                                 NULL, NULL, NULL,
-                                wcroot, parent_relpath,
+                                src_wcroot, parent_relpath, dst_wcroot,
                                 scratch_pool, scratch_pool));
       if (*copyfrom_relpath)
         *copyfrom_relpath = svn_relpath_join(*copyfrom_relpath, base_name,
@@ -4118,7 +4119,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
   else if (node_status == svn_wc__db_status_added)
     {
       SVN_ERR(scan_addition(&node_status, NULL, NULL, NULL, NULL, NULL, NULL,
-                            NULL, NULL, NULL, wcroot, local_relpath,
+                            NULL, NULL, NULL, src_wcroot, local_relpath,
                             scratch_pool, scratch_pool));
     }
   else if (node_status == svn_wc__db_status_deleted && is_op_root)
@@ -4127,7 +4128,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
 
       SVN_ERR(scan_deletion_txn(&base_del_relpath, NULL,
                                 &work_del_relpath,
-                                NULL, wcroot, local_relpath,
+                                NULL, src_wcroot, local_relpath,
                                 scratch_pool, scratch_pool));
       if (work_del_relpath)
         {
@@ -4140,7 +4141,8 @@ get_info_for_copy(apr_int64_t *copyfrom_
           SVN_ERR(scan_addition(NULL, &op_root_relpath,
                                 NULL, NULL, /* repos_* */
                                 copyfrom_relpath, copyfrom_id, copyfrom_rev,
-                                NULL, NULL, NULL, wcroot, parent_del_relpath,
+                                NULL, NULL, NULL,
+                                src_wcroot, parent_del_relpath,
                                 scratch_pool, scratch_pool));
           *copyfrom_relpath
             = svn_relpath_join(*copyfrom_relpath,
@@ -4155,7 +4157,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
                                                     copyfrom_id, NULL, NULL,
                                                     NULL, NULL, NULL, NULL,
                                                     NULL, NULL, NULL, NULL,
-                                                    wcroot, local_relpath,
+                                                    src_wcroot, local_relpath,
                                                     result_pool,
                                                     scratch_pool));
         }
@@ -4177,6 +4179,24 @@ get_info_for_copy(apr_int64_t *copyfrom_
   if (status)
     *status = node_status;
 
+  if (src_wcroot != dst_wcroot && *copyfrom_relpath)
+    {
+      const char *repos_root_url;
+      const char *repos_uuid;
+
+      /* Pass the right repos-id for the destination db. We can't just use
+         the id of the source database, as this value can change after
+         relocation (and perhaps also when we start storing multiple
+         working copies in a single db)! */
+
+      SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid,
+                                          src_wcroot->sdb, *copyfrom_id,
+                                          scratch_pool));
+
+      SVN_ERR(create_repos_id(copyfrom_id, repos_root_url, repos_uuid,
+                              dst_wcroot->sdb, scratch_pool));
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -4336,8 +4356,9 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
   const apr_array_header_t *children;
 
   SVN_ERR(get_info_for_copy(&copyfrom_id, &copyfrom_relpath, &copyfrom_rev,
-                            &status, &kind, &op_root, src_wcroot,
-                            src_relpath, scratch_pool, scratch_pool));
+                            &status, &kind, &op_root,
+                            src_wcroot, src_relpath, dst_wcroot,
+                            scratch_pool, scratch_pool));
 
   SVN_ERR(op_depth_for_copy(&dst_op_depth, &dst_np_op_depth,
                             &dst_parent_op_depth,
@@ -4562,21 +4583,6 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
     }
   else
     {
-      if (copyfrom_relpath)
-        {
-          const char *repos_root_url;
-          const char *repos_uuid;
-
-          /* Pass the right repos-id for the destination db! */
-
-          SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid,
-                                              src_wcroot->sdb, copyfrom_id,
-                                              scratch_pool));
-
-          SVN_ERR(create_repos_id(&copyfrom_id, repos_root_url, repos_uuid,
-                                  dst_wcroot->sdb, scratch_pool));
-        }
-
       SVN_ERR(cross_db_copy(src_wcroot, src_relpath, dst_wcroot,
                             dst_relpath, dst_presence, dst_op_depth,
                             dst_np_op_depth, kind,

Modified: subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/op-depth-test.c?rev=1588384&r1=1588383&r2=1588384&view=diff
==============================================================================
--- subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/op-depth-test.c Thu Apr 17 21:59:25 2014
@@ -55,6 +55,14 @@
 #pragma warning(disable: 4221) /* nonstandard extension used */
 #endif
 
+/* This macro is not available in 1.8.x, but let's just use it here */
+#ifndef SVN_VA_NULL
+struct svn_null_pointer_constant_stdarg_sentinel_t;
+
+/** Null pointer constant used as a sentinel in variable argument lists. */
+#define SVN_VA_NULL ((struct svn_null_pointer_constant_stdarg_sentinel_t*)0)
+#endif
+
 /* Compare strings, like strcmp but either or both may be NULL which
  * compares equal to NULL and not equal to any non-NULL string. */
 static int
@@ -8340,6 +8348,78 @@ move_abspath_more_than_once(const svn_te
 }
 
 
+static svn_error_t *
+repo_wc_copy(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t b;
+  const char *repos_dir;
+  const char *new_repos_dir;
+  const char *new_repos_url;
+
+  SVN_ERR(svn_test__sandbox_create(&b, "repo_wc_copy",
+                                   opts, pool));
+  SVN_ERR(sbox_add_and_commit_greek_tree(&b));
+
+  SVN_ERR(sbox_wc_copy_url(&b,
+                           svn_path_url_add_component2(b.repos_url, "A/B",
+                                                       pool),
+                           -1, "AA"));
+
+  {
+    nodes_row_t nodes[] = {
+
+      {1, "AA/lambda",   "normal", 1, "A/B/lambda"},
+      {1, "AA",          "normal", 1, "A/B"},
+      {1, "AA/E/beta",   "normal", 1, "A/B/E/beta"},
+      {1, "AA/E/alpha",  "normal", 1, "A/B/E/alpha"},
+      {1, "AA/F",        "normal", 1, "A/B/F"},
+      {1, "AA/E",        "normal", 1, "A/B/E"},
+
+      { 0 },
+    };
+    SVN_ERR(check_db_rows(&b, "AA", nodes));
+  }
+
+  SVN_ERR(svn_uri_get_dirent_from_file_url(&repos_dir, b.repos_url,
+                                           pool));
+  new_repos_dir = apr_pstrcat(pool, repos_dir, "-2", SVN_VA_NULL);
+  new_repos_url = apr_pstrcat(pool, b.repos_url, "-2", SVN_VA_NULL);
+
+  svn_test_add_dir_cleanup(new_repos_dir);
+
+  SVN_ERR(svn_io_remove_dir2(new_repos_dir, TRUE, NULL, NULL, pool));
+  SVN_ERR(svn_io_copy_dir_recursively(repos_dir,
+                                      svn_dirent_dirname(new_repos_dir, pool),
+                                      svn_dirent_basename(new_repos_dir, pool),
+                                      FALSE, NULL, NULL, pool));
+
+  SVN_ERR(sbox_wc_relocate(&b, new_repos_url));
+
+  /* This produced an invalid copy in Subversion <= 1.8.8.
+     Status would show all descendants as incomplete */
+  SVN_ERR(sbox_wc_copy_url(&b,
+                           svn_path_url_add_component2(b.repos_url, "A/B",
+                                                       pool),
+                           -1, "BB"));
+
+  {
+    nodes_row_t nodes[] = {
+
+      {1, "BB/lambda",   "normal", 1, "A/B/lambda"},
+      {1, "BB",          "normal", 1, "A/B"},
+      {1, "BB/E/beta",   "normal", 1, "A/B/E/beta"},
+      {1, "BB/E/alpha",  "normal", 1, "A/B/E/alpha"},
+      {1, "BB/F",        "normal", 1, "A/B/F"},
+      {1, "BB/E",        "normal", 1, "A/B/E"},
+
+      { 0 },
+    };
+    SVN_ERR(check_db_rows(&b, "BB", nodes));
+  }
+
+  return SVN_NO_ERROR;
+}
+
 /* ---------------------------------------------------------------------- */
 /* The list of test functions */
 
@@ -8497,5 +8577,7 @@ struct svn_test_descriptor_t test_funcs[
                        "move child to parent and revert (issue 4436)"),
     SVN_TEST_OPTS_XFAIL(move_abspath_more_than_once,
                        "move one abspath more than once"),
+    SVN_TEST_OPTS_PASS(repo_wc_copy,
+                       "repo_wc_copy"),
     SVN_TEST_NULL
   };

Modified: subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.c?rev=1588384&r1=1588383&r2=1588384&view=diff
==============================================================================
--- subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.c Thu Apr 17 21:59:25 2014
@@ -229,6 +229,45 @@ sbox_wc_copy(svn_test__sandbox_t *b, con
 }
 
 svn_error_t *
+sbox_wc_copy_url(svn_test__sandbox_t *b, const char *from_url,
+                 svn_revnum_t revision, const char *to_path)
+{
+  apr_pool_t *scratch_pool = b->pool;
+  svn_client_ctx_t *ctx;
+  svn_opt_revision_t rev = { svn_opt_revision_unspecified, {0} };
+  svn_client_copy_source_t* src;
+  apr_array_header_t *sources = apr_array_make(
+                                        scratch_pool, 1,
+                                        sizeof(svn_client_copy_source_t *));
+
+  SVN_ERR(svn_client_create_context2(&ctx, NULL, scratch_pool));
+  ctx->wc_ctx = b->wc_ctx;
+
+  if (SVN_IS_VALID_REVNUM(revision))
+    {
+      rev.kind = svn_opt_revision_number;
+      rev.value.number = revision;
+    }
+
+  src = apr_pcalloc(scratch_pool, sizeof(*src));
+
+  src->path = from_url;
+  src->revision = &rev;
+  src->peg_revision = &rev;
+
+  APR_ARRAY_PUSH(sources, svn_client_copy_source_t *) = src;
+
+  SVN_ERR(svn_client_copy6(sources, sbox_wc_path(b, to_path),
+                           FALSE, FALSE, FALSE, NULL, NULL, NULL,
+                           ctx, scratch_pool));
+
+  ctx->wc_ctx = NULL;
+
+  return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
 sbox_wc_revert(svn_test__sandbox_t *b, const char *path, svn_depth_t depth)
 {
   const char *abspath = sbox_wc_path(b, path);
@@ -292,15 +331,26 @@ sbox_wc_commit_ex(svn_test__sandbox_t *b
                   svn_depth_t depth)
 {
   svn_client_ctx_t *ctx;
-  SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool));
+  apr_pool_t *scratch_pool = svn_pool_create(b->pool);
+  svn_error_t *err;
+
+  SVN_ERR(svn_client_create_context2(&ctx, NULL, scratch_pool));
   ctx->wc_ctx = b->wc_ctx;
-  return svn_client_commit6(targets, depth,
-                            FALSE /* keep_locks */,
-                            FALSE /* keep_changelist */,
-                            TRUE  /* commit_as_operations */,
-                            TRUE  /* include_file_externals */,
-                            FALSE /* include_dir_externals */,
-                            NULL, NULL, NULL, NULL, ctx, b->pool);
+
+  /* A successfull commit doesn't close the ra session, but leaves that
+     to the caller. This leaves the BDB handle open, which might cause
+     problems in further test code. (op_depth_tests.c's repo_wc_copy) */
+  err = svn_client_commit6(targets, depth,
+                           FALSE /* keep_locks */,
+                           FALSE /* keep_changelist */,
+                           TRUE  /* commit_as_operations */,
+                           TRUE  /* include_file_externals */,
+                           FALSE /* include_dir_externals */,
+                           NULL, NULL, NULL, NULL, ctx, scratch_pool);
+
+  svn_pool_destroy(scratch_pool);
+
+  return svn_error_trace(err);
 }
 
 svn_error_t *
@@ -440,6 +490,24 @@ sbox_wc_propset(svn_test__sandbox_t *b,
 }
 
 svn_error_t *
+sbox_wc_relocate(svn_test__sandbox_t *b,
+                 const char *new_repos_url)
+{
+  apr_pool_t *scratch_pool = b->pool;
+  svn_client_ctx_t *ctx;
+
+  SVN_ERR(svn_client_create_context2(&ctx, NULL, scratch_pool));
+  ctx->wc_ctx = b->wc_ctx;
+
+  SVN_ERR(svn_client_relocate2(b->wc_abspath, b->repos_url,
+                               new_repos_url, FALSE, ctx,scratch_pool));
+
+  b->repos_url = apr_pstrdup(b->pool, new_repos_url);
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 sbox_add_and_commit_greek_tree(svn_test__sandbox_t *b)
 {
   const struct svn_test__tree_entry_t *node;

Modified: subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.h?rev=1588384&r1=1588383&r2=1588384&view=diff
==============================================================================
--- subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.h (original)
+++ subversion/branches/1.8.x-r1580626/subversion/tests/libsvn_wc/utils.h Thu Apr 17 21:59:25 2014
@@ -104,6 +104,14 @@ sbox_wc_mkdir(svn_test__sandbox_t *b, co
 svn_error_t *
 sbox_wc_copy(svn_test__sandbox_t *b, const char *from_path, const char *to_path);
 
+svn_error_t *
+sbox_wc_copy_url(svn_test__sandbox_t *b, const char *from_url,
+                 svn_revnum_t revision, const char *to_path);
+
+svn_error_t *
+sbox_wc_relocate(svn_test__sandbox_t *b,
+                 const char *new_repos_url);
+
 /* Revert a WC file or directory tree at PATH */
 svn_error_t *
 sbox_wc_revert(svn_test__sandbox_t *b, const char *path, svn_depth_t depth);