subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1355800 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_wc/tree_conflicts.c libsvn_wc/update_editor.c libsvn_wc/util.c libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/libsvn_wc/conflict-data-test.c
Date Sat, 30 Jun 2012 20:03:53 GMT
Author: rhuijben
Date: Sat Jun 30 20:03:51 2012
New Revision: 1355800

URL: http://svn.apache.org/viewvc?rev=1355800&view=rev
Log:
Remove the tree conflict data read functions from the svn_wc__db_ api.

* subversion/include/private/svn_wc_private.h
  (svn_wc__get_all_tree_conflicts): Remove function.

* subversion/libsvn_wc/tree_conflicts.c
  (svn_wc__add_tree_conflict): Check existence of tree conflict instead
    of reading.
  (svn_wc__get_tree_conflict): Read all conflicts and filter.

* subversion/libsvn_wc/update_editor.c
  (already_in_a_tree_conflict): Check tree conflict boolean instead of data.

* subversion/libsvn_wc/util.c
  (svn_wc__status2_from_3): Use svn_wc__get_tree_conflict() for obtaining tree
    conflict data.

* subversion/libsvn_wc/wc_db.c
  (read_all_tree_conflicts,
   svn_wc__db_op_read_all_tree_conflicts): Remove functions.

  (read_tree_conflict): Move documentation from wc_db.h here.
  (svn_wc__db_op_read_tree_conflict): Remove function.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_read_all_tree_conflicts,
   svn_wc__db_op_read_tree_conflict): Remove functions.

* subversion/tests/libsvn_wc/conflict-data-test.c
  (test_read_write_tree_conflicts): Read via common api. Load list of conflict
    victims instead of tree conflict victims.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/util.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1355800&r1=1355799&r2=1355800&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Sat Jun 30 20:03:51 2012
@@ -305,20 +305,6 @@ svn_wc__del_tree_conflict(svn_wc_context
                           const char *victim_abspath,
                           apr_pool_t *scratch_pool);
 
-
-/* Return a hash @a *tree_conflicts of all the children of @a
- * local_abspath that are in tree conflicts.  The hash maps local
- * abspaths to pointers to svn_wc_conflict_description2_t, all
- * allocated in result pool.
- */
-svn_error_t *
-svn_wc__get_all_tree_conflicts(apr_hash_t **tree_conflicts,
-                               svn_wc_context_t *wc_ctx,
-                               const char *local_abspath,
-                               apr_pool_t *result_pool,
-                               apr_pool_t *scratch_pool);
-
-
 /** Like svn_wc_is_wc_root(), but it doesn't consider switched subdirs or
  * deleted entries as working copy roots.
  */

Modified: subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/tree_conflicts.c?rev=1355800&r1=1355799&r2=1355800&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/tree_conflicts.c Sat Jun 30 20:03:51 2012
@@ -402,14 +402,22 @@ svn_wc__add_tree_conflict(svn_wc_context
                           const svn_wc_conflict_description2_t *conflict,
                           apr_pool_t *scratch_pool)
 {
-  const svn_wc_conflict_description2_t *existing_conflict;
+  svn_boolean_t existing_conflict;
   svn_skel_t *conflict_skel;
+  svn_error_t *err;
 
   /* Re-adding an existing tree conflict victim is an error. */
-  SVN_ERR(svn_wc__db_op_read_tree_conflict(&existing_conflict, wc_ctx->db,
-                                           conflict->local_abspath,
-                                           scratch_pool, scratch_pool));
-  if (existing_conflict != NULL)
+  err = svn_wc__internal_conflicted_p(NULL, NULL, &existing_conflict,
+                                      wc_ctx->db, conflict->local_abspath,
+                                      scratch_pool);
+  if (err)
+    {
+      if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+        return svn_error_trace(err);
+
+      svn_error_clear(err);
+    }
+  else if (existing_conflict)
     return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
                              _("Attempt to add tree conflict that already "
                                "exists at '%s'"),
@@ -456,44 +464,37 @@ svn_wc__add_tree_conflict(svn_wc_context
 svn_error_t *
 svn_wc__get_tree_conflict(const svn_wc_conflict_description2_t **tree_conflict,
                           svn_wc_context_t *wc_ctx,
-                          const char *victim_abspath,
+                          const char *local_abspath,
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool)
 {
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(victim_abspath));
+  const apr_array_header_t *conflicts;
+  int i;
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  return svn_error_trace(
-    svn_wc__db_op_read_tree_conflict(tree_conflict, wc_ctx->db, victim_abspath,
-                                     result_pool, scratch_pool));
-}
+  SVN_ERR(svn_wc__db_read_conflicts(&conflicts,
+                                    wc_ctx->db, local_abspath,
+                                    scratch_pool, scratch_pool));
 
-svn_error_t *
-svn_wc__get_all_tree_conflicts(apr_hash_t **tree_conflicts,
-                               svn_wc_context_t *wc_ctx,
-                               const char *local_abspath,
-                               apr_pool_t *result_pool,
-                               apr_pool_t *scratch_pool)
-{
-  apr_hash_t *conflicts;
-  apr_hash_index_t *hi;
-
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+  if (!conflicts || conflicts->nelts == 0)
+    {
+      *tree_conflict = NULL;
+      return SVN_NO_ERROR;
+    }
 
-  SVN_ERR(svn_wc__db_op_read_all_tree_conflicts(&conflicts, wc_ctx->db,
-                                                local_abspath,
-                                                result_pool, scratch_pool));
-  *tree_conflicts = apr_hash_make(result_pool);
-  /* Convert from basenames as keys to abspaths as keys. */
-  for (hi = apr_hash_first(scratch_pool, conflicts); hi;
-       hi = apr_hash_next(hi))
+  for (i = 0; i < conflicts->nelts; i++)
     {
-      const char *name = svn__apr_hash_index_key(hi);
-      const svn_wc_conflict_description2_t *conflict
-        = svn__apr_hash_index_val(hi);
-      const char *abspath = svn_dirent_join(local_abspath, name, scratch_pool);
+      const svn_wc_conflict_description2_t *desc;
 
-      apr_hash_set(*tree_conflicts, abspath, APR_HASH_KEY_STRING, conflict);
-    }
+      desc = APR_ARRAY_IDX(conflicts, i, svn_wc_conflict_description2_t *);
 
+      if (desc->kind == svn_wc_conflict_kind_tree)
+        {
+          *tree_conflict = svn_wc__conflict_description2_dup(desc,
+                                                             result_pool);
+          return SVN_NO_ERROR;
+        }
+    }
   return SVN_NO_ERROR;
 }
+

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1355800&r1=1355799&r2=1355800&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Sat Jun 30 20:03:51 2012
@@ -1636,30 +1636,17 @@ already_in_a_tree_conflict(svn_boolean_t
 
   while (TRUE)
     {
-      svn_boolean_t is_wc_root, has_conflict;
+      svn_boolean_t is_wc_root, tree_conflicted;
 
       svn_pool_clear(iterpool);
 
-      SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL, NULL, NULL,
-                                   &has_conflict, NULL, NULL, NULL,
-                                   NULL, NULL, NULL,
-                                   db, ancestor_abspath, iterpool, iterpool));
+      SVN_ERR(svn_wc__internal_conflicted_p(NULL, NULL, &tree_conflicted,
+                                            db, ancestor_abspath, iterpool));
 
-      if (has_conflict)
+      if (tree_conflicted)
         {
-          const svn_wc_conflict_description2_t *conflict;
-
-          SVN_ERR(svn_wc__db_op_read_tree_conflict(&conflict, db,
-                                                   ancestor_abspath,
-                                                   iterpool, iterpool));
-
-          if (conflict != NULL)
-            {
-              *conflicted = TRUE;
-              break;
-            }
+          *conflicted = TRUE;
+          break;
         }
 
       SVN_ERR(svn_wc__db_is_wcroot(&is_wc_root, db, ancestor_abspath,

Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=1355800&r1=1355799&r2=1355800&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Sat Jun 30 20:03:51 2012
@@ -448,9 +448,8 @@ svn_wc__status2_from_3(svn_wc_status2_t 
   if (old_status->conflicted)
     {
       const svn_wc_conflict_description2_t *tree_conflict;
-      SVN_ERR(svn_wc__db_op_read_tree_conflict(&tree_conflict, wc_ctx->db,
-                                               local_abspath, scratch_pool,
-                                               scratch_pool));
+      SVN_ERR(svn_wc__get_tree_conflict(&tree_conflict, wc_ctx, local_abspath,
+                                        scratch_pool, scratch_pool));
       (*status)->tree_conflict = svn_wc__cd2_to_cd(tree_conflict, result_pool);
     }
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1355800&r1=1355799&r2=1355800&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sat Jun 30 20:03:51 2012
@@ -6160,85 +6160,11 @@ svn_wc__db_revert_list_done(svn_wc__db_t
   return SVN_NO_ERROR;
 }
 
-/* Like svn_wc__db_op_read_all_tree_conflicts(), but with WCROOT+LOCAL_RELPATH
-   instead of DB+LOCAL_ABSPATH.  */
-static svn_error_t *
-read_all_tree_conflicts(apr_hash_t **tree_conflicts,
-                        svn_wc__db_wcroot_t *wcroot,
-                        const char *local_relpath,
-                        apr_pool_t *result_pool,
-                        apr_pool_t *scratch_pool)
-{
-  svn_sqlite__stmt_t *stmt;
-  svn_boolean_t have_row;
-  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-
-  *tree_conflicts = apr_hash_make(result_pool);
-
-  /* Get the conflict information for children of LOCAL_ABSPATH. */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                               STMT_SELECT_ACTUAL_CHILDREN_TREE_CONFLICT));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-  SVN_ERR(svn_sqlite__step(&have_row, stmt));
-  while (have_row)
-    {
-      const char *child_basename;
-      const char *child_relpath;
-      const char *child_abspath;
-      const char *conflict_data;
-      const svn_skel_t *skel;
-      const svn_wc_conflict_description2_t *conflict;
-
-      svn_pool_clear(iterpool);
-
-      child_relpath = svn_sqlite__column_text(stmt, 0, NULL);
-      child_basename = svn_relpath_basename(child_relpath, result_pool);
-      child_abspath = svn_dirent_join(wcroot->abspath, child_relpath, iterpool);
-
-      conflict_data = svn_sqlite__column_text(stmt, 1, NULL);
-      skel = svn_skel__parse(conflict_data, strlen(conflict_data), iterpool);
-      SVN_ERR(svn_wc__deserialize_conflict(&conflict, skel,
-                                           svn_dirent_dirname(child_abspath, iterpool),
-                                           result_pool, iterpool));
-
-      apr_hash_set(*tree_conflicts, child_basename, APR_HASH_KEY_STRING,
-                   conflict);
-
-      SVN_ERR(svn_sqlite__step(&have_row, stmt));
-    }
-  SVN_ERR(svn_sqlite__reset(stmt));
-
-  svn_pool_destroy(iterpool);
-
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_wc__db_op_read_all_tree_conflicts(apr_hash_t **tree_conflicts,
-                                      svn_wc__db_t *db,
-                                      const char *local_abspath,
-                                      apr_pool_t *result_pool,
-                                      apr_pool_t *scratch_pool)
-{
-  svn_wc__db_wcroot_t *wcroot;
-  const char *local_relpath;
+/* Get any tree conflict associated with LOCAL_RELPATH in WCROOT, and put it
+   in *TREE_CONFLICT, allocated in RESULT_POOL.
 
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-
-  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
-                              local_abspath, scratch_pool, scratch_pool));
-  VERIFY_USABLE_WCROOT(wcroot);
-
-  SVN_ERR(read_all_tree_conflicts(tree_conflicts, wcroot, local_relpath,
-                                  result_pool, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
-
-/* Like svn_wc__db_op_read_tree_conflict(), but with WCROOT+LOCAL_RELPATH
-   instead of DB+LOCAL_ABSPATH.  */
+   Use SCRATCH_POOL for any temporary allocations.
+ */
 static svn_error_t *
 read_tree_conflict(const svn_wc_conflict_description2_t **tree_conflict,
                    svn_wc__db_wcroot_t *wcroot,
@@ -6282,29 +6208,6 @@ read_tree_conflict(const svn_wc_conflict
                                   svn_sqlite__reset(stmt));
 }
 
-
-svn_error_t *
-svn_wc__db_op_read_tree_conflict(
-                     const svn_wc_conflict_description2_t **tree_conflict,
-                     svn_wc__db_t *db,
-                     const char *local_abspath,
-                     apr_pool_t *result_pool,
-                     apr_pool_t *scratch_pool)
-{
-  svn_wc__db_wcroot_t *wcroot;
-  const char *local_relpath;
-
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-
-  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
-                              local_abspath, scratch_pool, scratch_pool));
-
-  SVN_ERR(read_tree_conflict(tree_conflict, wcroot, local_relpath,
-                             result_pool, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
 /* Baton for remove_node_txn */
 struct remove_node_baton
 {

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1355800&r1=1355799&r2=1355800&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sat Jun 30 20:03:51 2012
@@ -1616,35 +1616,6 @@ svn_wc__db_revert_list_done(svn_wc__db_t
                             const char *local_abspath,
                             apr_pool_t *scratch_pool);
 
-
-/* Return a hash @a *tree_conflicts of all the children of @a
- * local_abspath that are in tree conflicts.  The hash maps local
- * basenames to pointers to svn_wc_conflict_description2_t, all
- * allocated in result pool.
- */
-/* ### this is not an OPERATION. remove the _op_.  */
-svn_error_t *
-svn_wc__db_op_read_all_tree_conflicts(apr_hash_t **tree_conflicts,
-                                      svn_wc__db_t *db,
-                                      const char *local_abspath,
-                                      apr_pool_t *result_pool,
-                                      apr_pool_t *scratch_pool);
-
-/* Get any tree conflict associated with LOCAL_ABSPATH in DB, and put it
-   in *TREE_CONFLICT, allocated in RESULT_POOL.
-
-   Use SCRATCH_POOL for any temporary allocations.
-*/
-/* ### this is not an OPERATION. remove the _op_.  */
-svn_error_t *
-svn_wc__db_op_read_tree_conflict(
-                     const svn_wc_conflict_description2_t **tree_conflict,
-                     svn_wc__db_t *db,
-                     const char *local_abspath,
-                     apr_pool_t *result_pool,
-                     apr_pool_t *scratch_pool);
-
-
 /* ### status */
 
 

Modified: subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c?rev=1355800&r1=1355799&r2=1355800&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c Sat Jun 30 20:03:51 2012
@@ -245,12 +245,12 @@ test_read_write_tree_conflicts(const svn
     SVN_TEST_ASSERT(! text_c && ! prop_c);
   }
 
-  /* Read one (conflict1 through WC-DB API, conflict2 through WC API) */
+  /* Read conflicts back */
   {
     const svn_wc_conflict_description2_t *read_conflict;
 
-    SVN_ERR(svn_wc__db_op_read_tree_conflict(&read_conflict, sbox.wc_ctx->db,
-                                             child1_abspath, pool, pool));
+    SVN_ERR(svn_wc__get_tree_conflict(&read_conflict, sbox.wc_ctx,
+                                      child1_abspath, pool, pool));
     SVN_ERR(compare_conflict(conflict1, read_conflict));
 
     SVN_ERR(svn_wc__get_tree_conflict(&read_conflict, sbox.wc_ctx,
@@ -258,32 +258,17 @@ test_read_write_tree_conflicts(const svn
     SVN_ERR(compare_conflict(conflict2, read_conflict));
   }
 
-  /* Read many (both through WC-DB API, both through WC API) */
+  /* Read many */
   {
-    apr_hash_t *all_conflicts;
-    const svn_wc_conflict_description2_t *read_conflict;
+    const apr_array_header_t *victims;
 
-    SVN_ERR(svn_wc__db_op_read_all_tree_conflicts(
-              &all_conflicts, sbox.wc_ctx->db, parent_abspath, pool, pool));
-    SVN_TEST_ASSERT(apr_hash_count(all_conflicts) == 2);
-    read_conflict = apr_hash_get(all_conflicts, "foo", APR_HASH_KEY_STRING);
-    SVN_ERR(compare_conflict(conflict1, read_conflict));
-    read_conflict = apr_hash_get(all_conflicts, "bar", APR_HASH_KEY_STRING);
-    SVN_ERR(compare_conflict(conflict2, read_conflict));
-
-    SVN_ERR(svn_wc__get_all_tree_conflicts(
-              &all_conflicts, sbox.wc_ctx, parent_abspath, pool, pool));
-    SVN_TEST_ASSERT(apr_hash_count(all_conflicts) == 2);
-    read_conflict = apr_hash_get(all_conflicts, child1_abspath,
-                                 APR_HASH_KEY_STRING);
-    SVN_ERR(compare_conflict(conflict1, read_conflict));
-    read_conflict = apr_hash_get(all_conflicts, child2_abspath,
-                                 APR_HASH_KEY_STRING);
-    SVN_ERR(compare_conflict(conflict2, read_conflict));
+    SVN_ERR(svn_wc__db_read_conflict_victims(&victims,
+                                             sbox.wc_ctx->db, parent_abspath,
+                                             pool, pool));
+    SVN_TEST_ASSERT(victims->nelts == 2);
   }
 
   /* ### TODO: to test...
-   * svn_wc__db_read_conflict_victims
    * svn_wc__db_read_conflicts
    * svn_wc__node_get_conflict_info
    * svn_wc__del_tree_conflict



Mime
View raw message