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 2015/01/15 16:51:39 UTC

svn commit: r1652142 - in /subversion/trunk/subversion: libsvn_wc/wc_db.c libsvn_wc/wc_db_private.h libsvn_wc/wc_db_update_move.c tests/libsvn_wc/op-depth-test.c

Author: rhuijben
Date: Thu Jan 15 15:51:39 2015
New Revision: 1652142

URL: http://svn.apache.org/r1652142
Log:
Avoid using wc_db when we can use a wcroot directly and add some missing
error handling logic.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_wq_add_internal): New function.

* subversion/libsvn_wc/wc_db_private.h
  (svn_wc__db_wq_add_internal): New function.

* subversion/libsvn_wc/wc_db_update_move.c
  (tc_editor_add_directory,
   tc_editor_add_file,
   tc_editor_alter_directory,
   update_working_file,
   tc_editor_delete): Update caller.

  (break_moved_away_children_internal): Reset statement on error.

* subversion/tests/libsvn_wc/op-depth-test.c
  (move4_update_delself_AAA): Add verification code right before the
    failing resolve.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db_private.h
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1652142&r1=1652141&r2=1652142&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Jan 15 15:51:39 2015
@@ -13047,6 +13047,15 @@ svn_wc__db_upgrade_get_repos_id(apr_int6
   return svn_error_trace(svn_sqlite__reset(stmt));
 }
 
+svn_error_t *
+svn_wc__db_wq_add_internal(svn_wc__db_wcroot_t *wcroot,
+                           const svn_skel_t *work_item,
+                           apr_pool_t *scratch_pool)
+{
+  /* Add the work item(s) to the WORK_QUEUE.  */
+  return svn_error_trace(add_work_items(wcroot->sdb, work_item,
+                                        scratch_pool));
+}
 
 svn_error_t *
 svn_wc__db_wq_add(svn_wc__db_t *db,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_private.h?rev=1652142&r1=1652141&r2=1652142&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_private.h Thu Jan 15 15:51:39 2015
@@ -216,6 +216,13 @@ svn_wc__db_util_open_db(svn_sqlite__db_t
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool);
 
+/* Like svn_wc__db_wq_add() but taking WCROOT */
+svn_error_t *
+svn_wc__db_wq_add_internal(svn_wc__db_wcroot_t *wcroot,
+                           const svn_skel_t *work_item,
+                           apr_pool_t *scratch_pool);
+
+
 /* Like svn_wc__db_read_info(), but taking WCROOT+LOCAL_RELPATH instead of
    DB+LOCAL_ABSPATH, and outputting repos ids instead of URL+UUID. */
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1652142&r1=1652141&r2=1652142&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Thu Jan 15 15:51:39 2015
@@ -593,8 +593,7 @@ tc_editor_add_directory(update_move_bato
       SVN_ERR(svn_wc__wq_build_dir_install(&work_item, b->db, abspath,
                                            scratch_pool, scratch_pool));
 
-      SVN_ERR(svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_item,
-                                scratch_pool));
+      SVN_ERR(svn_wc__db_wq_add_internal(b->wcroot, work_item, scratch_pool));
       /* Fall through */
     case svn_node_dir:
       break;
@@ -680,8 +679,7 @@ tc_editor_add_file(update_move_baton_t *
                                         TRUE  /* record_file_info */,
                                         scratch_pool, scratch_pool));
 
-  SVN_ERR(svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_item,
-                            scratch_pool));
+  SVN_ERR(svn_wc__db_wq_add_internal(b->wcroot, work_item, scratch_pool));
 
   SVN_ERR(update_move_list_add(b->wcroot, relpath,
                                svn_wc_notify_update_add,
@@ -884,8 +882,8 @@ tc_editor_alter_directory(update_move_ba
           SVN_ERR(svn_wc__db_mark_conflict_internal(b->wcroot, dst_relpath,
                                                     conflict_skel,
                                                     scratch_pool));
-          SVN_ERR(svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_items,
-                                    scratch_pool));
+          SVN_ERR(svn_wc__db_wq_add_internal(b->wcroot, work_items,
+                                             scratch_pool));
         }
 
     SVN_ERR(update_move_list_add(b->wcroot, dst_relpath,
@@ -1020,8 +1018,7 @@ update_working_file(update_move_baton_t
       work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
     }
 
-  SVN_ERR(svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_items,
-                            scratch_pool));
+  SVN_ERR(svn_wc__db_wq_add_internal(b->wcroot, work_items, scratch_pool));
 
   SVN_ERR(update_move_list_add(b->wcroot, local_relpath,
                                svn_wc_notify_update_update,
@@ -1199,8 +1196,7 @@ tc_editor_delete(update_move_baton_t *b,
                                                b->wcroot->abspath, del_abspath,
                                                iterpool, iterpool);
           if (!err)
-            err = svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_item,
-                                    iterpool);
+            err = svn_wc__db_wq_add_internal(b->wcroot, work_item, iterpool);
           if (err)
             return svn_error_compose_create(err, svn_sqlite__reset(stmt));
 
@@ -1222,8 +1218,7 @@ tc_editor_delete(update_move_baton_t *b,
         SVN_ERR(svn_wc__wq_build_file_remove(&work_item, b->db,
                                              b->wcroot->abspath, local_abspath,
                                              iterpool, iterpool));
-      SVN_ERR(svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_item,
-                                iterpool));
+      SVN_ERR(svn_wc__db_wq_add_internal(b->wcroot, work_item, iterpool));
 
       if (!is_conflicted)
         SVN_ERR(update_move_list_add(b->wcroot, relpath,
@@ -2574,16 +2569,29 @@ break_moved_away_children_internal(svn_w
       const char *src_relpath = svn_sqlite__column_text(stmt, 0, NULL);
       const char *dst_relpath = svn_sqlite__column_text(stmt, 1, NULL);
       int src_op_depth = svn_sqlite__column_int(stmt, 2);
+      svn_error_t *err;
 
       svn_pool_clear(iterpool);
 
-      SVN_ERR(break_move(wcroot, src_relpath, src_op_depth, dst_relpath,
-                         iterpool));
-      SVN_ERR(update_move_list_add(wcroot, src_relpath,
-                                   svn_wc_notify_move_broken,
-                                   svn_node_unknown,
-                                   svn_wc_notify_state_inapplicable,
-                                   svn_wc_notify_state_inapplicable));
+      err = break_move(wcroot, src_relpath, src_op_depth, dst_relpath,
+                       iterpool);
+
+      if (! err)
+        {
+          err = update_move_list_add(wcroot, src_relpath,
+                                     svn_wc_notify_move_broken,
+                                     svn_node_unknown,
+                                     svn_wc_notify_state_inapplicable,
+                                     svn_wc_notify_state_inapplicable);
+        }
+
+      if (err)
+        {
+          return svn_error_trace(
+                          svn_error_compose_create(err,
+                                                   svn_sqlite__reset(stmt)));
+        }
+
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }
   svn_pool_destroy(iterpool);

Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1652142&r1=1652141&r2=1652142&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Thu Jan 15 15:51:39 2015
@@ -9319,6 +9319,58 @@ move4_update_delself_AAA(const svn_test_
     SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
     /* Go back to start position */
     SVN_ERR(sbox_wc_update(&b, "", 1));
+    {
+      nodes_row_t nodes[] = {
+        {0, "",               "normal",       1, ""},
+        {0, "A",              "normal",       1, "A"},
+        {1, "A",              "normal",       2, "B", FALSE, "A_moved", TRUE},
+        {0, "A/A",            "normal",       1, "A/A"},
+        {1, "A/A",            "normal",       2, "B/A", MOVED_HERE},
+        {2, "A/A",            "normal",       2, "C/A", FALSE, "BA_moved", TRUE},
+        {1, "A/A/A",          "base-deleted", NO_COPY_FROM},
+        {0, "A/A/A",          "normal",       1, "A/A/A"},
+        {3, "A/A/A",          "normal",       1, "D/A/A"},
+        {1, "A/A/A/A",        "base-deleted", NO_COPY_FROM},
+        {0, "A/A/A/A",        "normal",       1, "A/A/A/A"},
+        {3, "A/A/A/A",        "normal",       1, "D/A/A/A"},
+        {1, "AAA_1",          "normal",       1, "A/A/A"},
+        {1, "AAA_1/A",        "normal",       1, "A/A/A/A"},
+        {1, "AAA_2",          "normal",       1, "B/A/A"},
+        {1, "AAA_2/A",        "normal",       1, "B/A/A/A"},
+        {1, "AAA_3",          "normal",       1, "C/A/A"},
+        {1, "AAA_3/A",        "normal",       1, "C/A/A/A"},
+        {1, "A_moved",        "normal",       2, "A", MOVED_HERE},
+        {1, "A_moved/A",      "normal",       2, "A/A", MOVED_HERE},
+        {3, "A_moved/A/A/A",  "base-deleted", NO_COPY_FROM},
+        {1, "B",              "base-deleted", NO_COPY_FROM, "A"},
+        {0, "B",              "normal",       1, "B"},
+        {1, "B/A",            "base-deleted", NO_COPY_FROM},
+        {0, "B/A",            "normal",       1, "B/A"},
+        {1, "B/A/A",          "base-deleted", NO_COPY_FROM},
+        {0, "B/A/A",          "normal",       1, "B/A/A"},
+        {1, "B/A/A/A",        "base-deleted", NO_COPY_FROM},
+        {0, "B/A/A/A",        "normal",       1, "B/A/A/A"},
+        {1, "BA_moved",       "normal",       1, "A/A", MOVED_HERE},
+        {1, "BA_moved/A",     "normal",       1, "A/A/A", MOVED_HERE},
+        {2, "BA_moved/A/A",   "base-deleted", NO_COPY_FROM},
+        {1, "BA_moved/A/A",   "normal",       1, "A/A/A/A", MOVED_HERE},
+        {0, "C",              "normal",       1, "C"},
+        {2, "C/A",            "base-deleted", NO_COPY_FROM, "A/A"},
+        {0, "C/A",            "normal",       1, "C/A"},
+        {2, "C/A/A",          "base-deleted", NO_COPY_FROM},
+        {0, "C/A/A",          "normal",       1, "C/A/A"},
+        {2, "C/A/A/A",        "base-deleted", NO_COPY_FROM},
+        {0, "C/A/A/A",        "normal",       1, "C/A/A/A"},
+        {0, "D",              "normal",       1, "D"},
+        {0, "D/A",            "normal",       1, "D/A"},
+        {0, "D/A/A",          "normal",       1, "D/A/A"},
+        {0, "D/A/A/A",        "normal",       1, "D/A/A/A"},
+
+        { 0 },
+      };
+        SVN_ERR(check_db_rows(&b, "", nodes));
+    }
+    SVN_DBG(("---------------"));
     SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
     /* Update and resolve via their strategy */
     SVN_ERR(sbox_wc_update(&b, "", 2));