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 2012/07/06 00:22:27 UTC

svn commit: r1357972 - in /subversion/trunk/subversion: libsvn_wc/update_editor.c libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/libsvn_wc/db-test.c

Author: rhuijben
Date: Thu Jul  5 22:22:27 2012
New Revision: 1357972

URL: http://svn.apache.org/viewvc?rev=1357972&view=rev
Log:
* subversion/libsvn_wc/update_editor.c
  (add_directory): Update caller.

* subversion/libsvn_wc/wc_db.c
  (insert_base_baton_t): Add delete_working bool.
  (insert_base_node): Add delete_working support.

  (svn_wc__db_base_add_file): Add new flags. Move skels to end.
   svn_wc__db_base_add_symlink): Make arguments match _file variant.

  (svn_wc__db_temp_op_remove_working): Remove functions.

  (svn_wc__db_op_begin_update): Add flags.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_base_add_file): Add flags.
  (svn_wc__db_base_add_symlink): Add flags.
  (svn_wc__db_temp_op_remove_working): Remove function.
  (svn_wc__db_op_begin_update): Add flags.

* subversion/tests/libsvn_wc/db-test.c
  (test_inserting_nodes): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/tests/libsvn_wc/db-test.c

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1357972&r1=1357971&r2=1357972&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Jul  5 22:22:27 2012
@@ -2238,6 +2238,9 @@ add_directory(const char *path,
                                      eb->repos_uuid,
                                      *eb->target_revision,
                                      db->ambient_depth,
+                                     (db->shadowed && db->obstruction_found),
+                                     (! db->shadowed
+                                      && status == svn_wc__db_status_added),
                                      tree_conflict, NULL,
                                      pool));
 
@@ -2246,22 +2249,6 @@ add_directory(const char *path,
   if (!db->shadowed && !pb->moved_to_abspath)
     SVN_ERR(svn_wc__ensure_directory(db->local_abspath, pool));
 
-  if (!db->shadowed && status == svn_wc__db_status_added)
-    /* If there is no conflict we take over any added directory */
-    SVN_ERR(svn_wc__db_temp_op_remove_working(eb->db, db->local_abspath, pool));
-
-  /* ### We can't record an unversioned obstruction yet, so
-     ### we record a delete instead, which will allow resolving the conflict
-     ### to theirs with 'svn revert'. */
-  if (db->shadowed && db->obstruction_found)
-    {
-      SVN_ERR(svn_wc__db_op_delete(eb->db, db->local_abspath, NULL,
-                                   tree_conflict, NULL,
-                                   eb->cancel_func, eb->cancel_baton,
-                                   NULL, NULL /* notification */,
-                                   pool));
-    }
-
   if (tree_conflict != NULL)
     {
       db->already_notified = TRUE;
@@ -4532,11 +4519,12 @@ close_file(void *file_baton,
                                                       dav_prop_changes,
                                                       scratch_pool)
                                      : NULL,
-                                   conflict_skel,
+                                   (fb->add_existed && fb->adding_file),
                                    (! fb->shadowed) && new_base_props,
                                    new_actual_props,
                                    keep_recorded_info,
                                    (fb->shadowed && fb->obstruction_found),
+                                   conflict_skel,
                                    all_work_items,
                                    scratch_pool));
 
@@ -4570,15 +4558,6 @@ close_file(void *file_baton,
                                       scratch_pool));
     }
 
-  /* If this file was locally-added and is now being added by the update, we
-     can toss the local-add, turning this into a local-edit.
-     If the local file is replaced, we don't want to touch ACTUAL. */
-  if (fb->add_existed && fb->adding_file)
-    {
-      SVN_ERR(svn_wc__db_temp_op_remove_working(eb->db, fb->local_abspath,
-                                                scratch_pool));
-    }
-
   apr_hash_set(fb->dir_baton->not_present_files, fb->name,
                APR_HASH_KEY_STRING, NULL);
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1357972&r1=1357971&r2=1357972&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Jul  5 22:22:27 2012
@@ -182,6 +182,9 @@ typedef struct insert_base_baton_t {
   /* insert a base-deleted working node as well as a base node */
   svn_boolean_t insert_base_deleted;
 
+  /* delete the current working nodes above BASE */
+  svn_boolean_t delete_working;
+
   /* may have work items to queue in this transaction  */
   const svn_skel_t *work_items;
 
@@ -885,6 +888,13 @@ insert_base_node(void *baton,
         }
     }
 
+  if (pibb->delete_working)
+    {
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_DELETE_WORKING_NODE));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+    }
   if (pibb->insert_base_deleted)
     {
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -1720,11 +1730,12 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
                          const char *changed_author,
                          const svn_checksum_t *checksum,
                          apr_hash_t *dav_cache,
-                         const svn_skel_t *conflict,
+                         svn_boolean_t delete_working,
                          svn_boolean_t update_actual_props,
                          apr_hash_t *new_actual_props,
                          svn_boolean_t keep_recorded_info,
                          svn_boolean_t insert_base_deleted,
+                         const svn_skel_t *conflict,
                          const svn_skel_t *work_items,
                          apr_pool_t *scratch_pool)
 {
@@ -1765,8 +1776,6 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
   ibb.checksum = checksum;
 
   ibb.dav_cache = dav_cache;
-  ibb.conflict = conflict;
-  ibb.work_items = work_items;
 
   if (update_actual_props)
     {
@@ -1776,6 +1785,10 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
 
   ibb.keep_recorded_info = keep_recorded_info;
   ibb.insert_base_deleted = insert_base_deleted;
+  ibb.delete_working = delete_working;
+
+  ibb.conflict = conflict;
+  ibb.work_items = work_items;
 
   SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, insert_base_node, &ibb,
                               scratch_pool));
@@ -1802,9 +1815,12 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
                             const char *changed_author,
                             const char *target,
                             apr_hash_t *dav_cache,
-                            const svn_skel_t *conflict,
+                            svn_boolean_t delete_working,
                             svn_boolean_t update_actual_props,
                             apr_hash_t *new_actual_props,
+                            svn_boolean_t keep_recorded_info,
+                            svn_boolean_t insert_base_deleted,
+                            const svn_skel_t *conflict,
                             const svn_skel_t *work_items,
                             apr_pool_t *scratch_pool)
 {
@@ -1844,8 +1860,6 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
   ibb.target = target;
 
   ibb.dav_cache = dav_cache;
-  ibb.conflict = conflict;
-  ibb.work_items = work_items;
 
   if (update_actual_props)
     {
@@ -1853,6 +1867,13 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
       ibb.new_actual_props = new_actual_props;
     }
 
+  ibb.keep_recorded_info = keep_recorded_info;
+  ibb.insert_base_deleted = insert_base_deleted;
+  ibb.delete_working = delete_working;
+
+  ibb.conflict = conflict;
+  ibb.work_items = work_items;
+
   SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, insert_base_node, &ibb,
                               scratch_pool));
 
@@ -6530,33 +6551,6 @@ svn_wc__db_op_remove_node(svn_wc__db_t *
 }
 
 
-svn_error_t *
-svn_wc__db_temp_op_remove_working(svn_wc__db_t *db,
-                                  const char *local_abspath,
-                                  apr_pool_t *scratch_pool)
-{
-  svn_wc__db_wcroot_t *wcroot;
-  svn_sqlite__stmt_t *stmt;
-  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));
-  VERIFY_USABLE_WCROOT(wcroot);
-
-  /* ### Use depth value other than empty? */
-  SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_empty,
-                        scratch_pool));
-
-  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_DELETE_WORKING_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-  SVN_ERR(svn_sqlite__step_done(stmt));
-
-  return SVN_NO_ERROR;
-}
-
 /* Baton for db_op_set_base_depth */
 struct set_base_depth_baton_t
 {
@@ -13046,6 +13040,8 @@ svn_wc__db_op_begin_update(svn_wc__db_t 
                            const char *repos_uuid,
                            svn_revnum_t revision,
                            svn_depth_t depth,
+                           svn_boolean_t insert_base_deleted,
+                           svn_boolean_t delete_working,
                            svn_skel_t *conflict,
                            svn_skel_t *work_items,
                            apr_pool_t *scratch_pool)
@@ -13075,6 +13071,9 @@ svn_wc__db_op_begin_update(svn_wc__db_t 
   ibb.repos_relpath = repos_relpath;
   ibb.revision = revision;
   ibb.depth = depth;
+  ibb.insert_base_deleted = insert_base_deleted;
+  ibb.delete_working = delete_working;
+
   ibb.conflict = conflict;
   ibb.work_items = work_items;
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1357972&r1=1357971&r2=1357972&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Jul  5 22:22:27 2012
@@ -484,11 +484,12 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
                          const char *changed_author,
                          const svn_checksum_t *checksum,
                          apr_hash_t *dav_cache,
-                         const svn_skel_t *conflict,
+                         svn_boolean_t delete_working,
                          svn_boolean_t update_actual_props,
                          apr_hash_t *new_actual_props,
                          svn_boolean_t keep_recorded_info,
                          svn_boolean_t insert_base_deleted,
+                         const svn_skel_t *conflict,
                          const svn_skel_t *work_items,
                          apr_pool_t *scratch_pool);
 
@@ -565,9 +566,12 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
                             const char *changed_author,
                             const char *target,
                             apr_hash_t *dav_cache,
-                            const svn_skel_t *conflict,
+                            svn_boolean_t delete_working,
                             svn_boolean_t update_actual_props,
                             apr_hash_t *new_actual_props,
+                            svn_boolean_t keep_recorded_info,
+                            svn_boolean_t insert_base_deleted,
+                            const svn_skel_t *conflict,
                             const svn_skel_t *work_items,
                             apr_pool_t *scratch_pool);
 
@@ -2817,12 +2821,6 @@ svn_wc__db_op_remove_node(svn_wc__db_t *
                           svn_kind_t not_present_kind,
                           apr_pool_t *scratch_pool);
 
-/* Remove the WORKING_NODE row of LOCAL_ABSPATH in DB. */
-svn_error_t *
-svn_wc__db_temp_op_remove_working(svn_wc__db_t *db,
-                                  const char *local_abspath,
-                                  apr_pool_t *scratch_pool);
-
 /* Sets the depth of LOCAL_ABSPATH in its working copy to DEPTH using DB.
 
    Returns SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not a BASE directory
@@ -2931,6 +2929,8 @@ svn_wc__db_op_begin_update(svn_wc__db_t 
                            const char *repos_uuid,
                            svn_revnum_t revision,
                            svn_depth_t depth,
+                           svn_boolean_t insert_base_deleted,
+                           svn_boolean_t delete_working,
                            svn_skel_t *conflict,
                            svn_skel_t *work_items,
                            apr_pool_t *scratch_pool);

Modified: subversion/trunk/subversion/tests/libsvn_wc/db-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/db-test.c?rev=1357972&r1=1357971&r2=1357972&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Thu Jul  5 22:22:27 2012
@@ -664,7 +664,8 @@ test_inserting_nodes(apr_pool_t *pool)
             props,
             1, TIME_1a, AUTHOR_1,
             checksum,
-            NULL, NULL, FALSE, NULL, FALSE, FALSE, NULL,
+            NULL, FALSE, FALSE, NULL, FALSE, FALSE,
+            NULL, NULL,
             pool));
 
   /* Create a new symlink node. */
@@ -676,7 +677,8 @@ test_inserting_nodes(apr_pool_t *pool)
             props,
             1, TIME_1a, AUTHOR_1,
             "O-target",
-            NULL, NULL, FALSE, NULL, NULL,
+            NULL, FALSE, FALSE, NULL, FALSE, FALSE,
+            NULL, NULL,
             pool));
 
   /* Replace an incomplete node with an absent file node. */