subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1771298 - /subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
Date Fri, 25 Nov 2016 11:43:53 GMT
Author: stsp
Date: Fri Nov 25 11:43:53 2016
New Revision: 1771298

URL: http://svn.apache.org/viewvc?rev=1771298&view=rev
Log:
Introduce a special 'delete' editor callback for updates of incoming moves.

* subversion/libsvn_wc/wc_db_update_move.c
  (tc_incoming_editor_delete): New. Deletes a working node instead of removing
   a row at a particular op-depth as in the local-move update case.
  (update_incoming_moved_node): Invoke the new function.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c

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=1771298&r1=1771297&r2=1771298&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Fri Nov 25 11:43:53 2016
@@ -1484,6 +1484,93 @@ tc_editor_delete(node_move_baton_t *nmb,
   return SVN_NO_ERROR;
 }
 
+/* Handle node deletion for an incoming move. */
+static svn_error_t *
+tc_incoming_editor_delete(node_move_baton_t *nmb,
+                          const char *relpath,
+                          svn_node_kind_t old_kind,
+                          svn_node_kind_t new_kind,
+                          apr_pool_t *scratch_pool)
+{
+  update_move_baton_t *b = nmb->umb;
+  svn_sqlite__stmt_t *stmt;
+  const char *local_abspath;
+  svn_boolean_t is_modified, is_all_deletes;
+  svn_skel_t *work_items = NULL;
+  svn_skel_t *conflict = NULL;
+
+  SVN_ERR(mark_parent_edited(nmb, scratch_pool));
+  if (nmb->skip)
+    return SVN_NO_ERROR;
+
+  /* Check before retracting delete to catch delete-delete
+     conflicts. This catches conflicts on the node itself; deleted
+     children are caught as local modifications below.*/
+  if (nmb->shadowed)
+    {
+      SVN_ERR(mark_tc_on_op_root(nmb,
+                                 old_kind, new_kind,
+                                 svn_wc_conflict_action_delete,
+                                 scratch_pool));
+      return SVN_NO_ERROR;
+    }
+
+  local_abspath = svn_dirent_join(b->wcroot->abspath, relpath, scratch_pool);
+  SVN_ERR(svn_wc__node_has_local_mods(&is_modified, &is_all_deletes,
+                                      nmb->umb->db, local_abspath, FALSE,
+                                      NULL, NULL, scratch_pool));
+  if (is_modified)
+    {
+      svn_wc_conflict_reason_t reason;
+
+      /* No conflict means no NODES rows at the relpath op-depth
+         so it's easy to convert the modified tree into a copy.
+
+         Note the following assumptions for relpath:
+            * it is not shadowed
+            * it is not the/an op-root. (or we can't make us a copy)
+       */
+
+      SVN_ERR(svn_wc__db_op_make_copy_internal(b->wcroot, relpath, FALSE,
+                                               NULL, NULL, scratch_pool));
+
+      reason = svn_wc_conflict_reason_edited;
+
+      SVN_ERR(create_node_tree_conflict(&conflict, nmb, relpath,
+                                        old_kind, new_kind, reason,
+                                        (new_kind == svn_node_none)
+                                          ? svn_wc_conflict_action_delete
+                                          : svn_wc_conflict_action_replace,
+                                        NULL,
+                                        scratch_pool, scratch_pool));
+      nmb->skip = TRUE;
+    }
+  else
+    {
+      /* Delete the WORKING node at DST_RELPATH. */
+      SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                 STMT_INSERT_DELETE_FROM_NODE_RECURSIVE));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isdd",
+                                b->wcroot->wc_id, relpath,
+                                0, relpath_depth(relpath)));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+    }
+
+  /* Only notify if add_file/add_dir is not going to notify */
+  if (conflict || (new_kind == svn_node_none))
+    SVN_ERR(update_move_list_add(b->wcroot, relpath, b->db,
+                                 svn_wc_notify_update_delete,
+                                 new_kind,
+                                 svn_wc_notify_state_inapplicable,
+                                 svn_wc_notify_state_inapplicable,
+                                 conflict, work_items, scratch_pool));
+  else if (work_items)
+    SVN_ERR(svn_wc__db_wq_add_internal(b->wcroot, work_items,
+                                       scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 /*
  * Driver code.
  *
@@ -2094,8 +2181,8 @@ update_incoming_moved_node(node_move_bat
   if (working_kind == svn_node_none
       || (orig_kind != svn_node_none && orig_kind != working_kind))
     {
-      SVN_ERR(tc_editor_delete(nmb, dst_relpath, orig_kind, working_kind,
-                               scratch_pool));
+      SVN_ERR(tc_incoming_editor_delete(nmb, dst_relpath, orig_kind,
+                                        working_kind, scratch_pool));
     }
 
   if (nmb->skip)



Mime
View raw message