subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1731220 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/resolved.c libsvn_wc/conflicts.c
Date Fri, 19 Feb 2016 10:53:33 GMT
Author: stsp
Date: Fri Feb 19 10:53:32 2016
New Revision: 1731220

URL: http://svn.apache.org/viewvc?rev=1731220&view=rev
Log:
Provide another private libsvn_wc API function for resolving a tree conflict.

This function resolves a 'local moved-away vs. incoming edit' conflict
upon update/switch. Use this new API from libsvn_client's new conflict
resolver instead of calling the generic svn_wc__resolve_conflicts()
function for this conflict.

* subversion/include/private/svn_wc_private.h
  (svn_wc__conflict_tree_update_moved_away_node): Declare and document.

* subversion/libsvn_client/resolved.c
  (resolve_tree_conflict): Call svn_wc__conflict_tree_update_moved_away_node()
   if appropriate for the tree conflict and its resolution option.
   Break single if-statement into several if-else-if for readability.

* subversion/libsvn_wc/conflicts.c
  (svn_wc__conflict_tree_update_moved_away_node): Implement, based on existing
   code from resolve_tree_conflict_on_node().

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/resolved.c
    subversion/trunk/subversion/libsvn_wc/conflicts.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=1731220&r1=1731219&r2=1731220&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Fri Feb 19 10:53:32 2016
@@ -1855,6 +1855,40 @@ svn_wc__conflict_tree_update_raise_moved
                                               void *notify_baton,
                                               apr_pool_t *scratch_pool);
 
+/* Resolve a tree conflict where the victim at LOCAL_ABSPATH is a file or
+ * directory which was locally moved away, and which received an edit (some
+ * change inside the directory or file, or a change to properties) during an
+ * update or switch operation.
+ *
+ * The conflict is resolved by keeping the victim moved-away, and propagating
+ * the incoming edits to the victim's moved-to location.
+ *
+ * The tree conflict at LOCAL_ABSPATH must have the following properties or
+ * SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE will be returned:
+ * 
+ * operation: svn_wc_operation_update or svn_wc_operation_switch
+ * local change: svn_wc_conflict_reason_moved_away
+ * incoming change: svn_wc_conflict_action_edit
+ *
+ * If this conflict cannot be resolved this function returns
+ * SVN_ERR_WC_OBSTRUCTED_UPDATE or SVN_ERR_WC_FOUND_CONFLICT.
+ * The caller should continue by resolving other conflicts and attempt to
+ * resolve this conflict again later.
+ *
+ * The working copy must already be locked for resolving, e.g. by calling
+ * svn_wc__acquire_write_lock_for_resolve() first.
+ *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_wc__conflict_tree_update_moved_away_node(svn_wc_context_t *wc_ctx,
+                                             const char *local_abspath,
+                                             svn_cancel_func_t cancel_func,
+                                             void *cancel_baton,
+                                             svn_wc_notify_func2_t notify_func,
+                                             void *notify_baton,
+                                             apr_pool_t *scratch_pool);
+
 /**
  * Move @a src_abspath to @a dst_abspath, by scheduling @a dst_abspath
  * for addition to the repository, remembering the history. Mark @a src_abspath

Modified: subversion/trunk/subversion/libsvn_client/resolved.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/resolved.c?rev=1731220&r1=1731219&r2=1731220&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/resolved.c (original)
+++ subversion/trunk/subversion/libsvn_client/resolved.c Fri Feb 19 10:53:32 2016
@@ -812,30 +812,50 @@ resolve_tree_conflict(svn_client_conflic
                                                  local_abspath,
                                                  scratch_pool, scratch_pool));
 
-  if ((option_id == svn_client_conflict_option_merged_text ||
-       (option_id == svn_client_conflict_option_update_any_moved_away_children
-        && incoming_change == svn_wc_conflict_action_edit)) &&
-      (operation == svn_wc_operation_update ||
+  if ((operation == svn_wc_operation_update ||
        operation == svn_wc_operation_switch) &&
       (local_change == svn_wc_conflict_reason_deleted ||
-       local_change == svn_wc_conflict_reason_replaced))
+       local_change == svn_wc_conflict_reason_replaced) &&
+      option_id == svn_client_conflict_option_merged_text)
     {
-      if (option_id == svn_client_conflict_option_merged_text)
-        err = svn_wc__conflict_tree_update_break_moved_away(ctx->wc_ctx,
-                                                            local_abspath,
-                                                            ctx->cancel_func,
-                                                            ctx->cancel_baton,
-                                                            ctx->notify_func2,
-                                                            ctx->notify_baton2,
-                                                            scratch_pool);
-      else
-        err = svn_wc__conflict_tree_update_raise_moved_away(ctx->wc_ctx,
-                                                            local_abspath,
-                                                            ctx->cancel_func,
-                                                            ctx->cancel_baton,
-                                                            ctx->notify_func2,
-                                                            ctx->notify_baton2,
-                                                            scratch_pool);
+      err = svn_wc__conflict_tree_update_break_moved_away(ctx->wc_ctx,
+                                                          local_abspath,
+                                                          ctx->cancel_func,
+                                                          ctx->cancel_baton,
+                                                          ctx->notify_func2,
+                                                          ctx->notify_baton2,
+                                                          scratch_pool);
+    }
+  else if ((operation == svn_wc_operation_update ||
+            operation == svn_wc_operation_switch) &&
+           (local_change == svn_wc_conflict_reason_deleted ||
+            local_change == svn_wc_conflict_reason_replaced) &&
+           incoming_change == svn_wc_conflict_action_edit &&
+           option_id ==
+             svn_client_conflict_option_update_any_moved_away_children)
+    {
+      err = svn_wc__conflict_tree_update_raise_moved_away(ctx->wc_ctx,
+                                                          local_abspath,
+                                                          ctx->cancel_func,
+                                                          ctx->cancel_baton,
+                                                          ctx->notify_func2,
+                                                          ctx->notify_baton2,
+                                                          scratch_pool);
+    }
+  else if ((operation == svn_wc_operation_update ||
+            operation == svn_wc_operation_switch) &&
+           local_change == svn_wc_conflict_reason_moved_away &&
+           incoming_change == svn_wc_conflict_action_edit &&
+           option_id ==
+             svn_client_conflict_option_working_text_where_conflicted)
+    {
+      err = svn_wc__conflict_tree_update_moved_away_node(ctx->wc_ctx,
+                                                         local_abspath,
+                                                         ctx->cancel_func,
+                                                         ctx->cancel_baton,
+                                                         ctx->notify_func2,
+                                                         ctx->notify_baton2,
+                                                         scratch_pool);
     }
   else
     {

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1731220&r1=1731219&r2=1731220&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Fri Feb 19 10:53:32 2016
@@ -3551,3 +3551,82 @@ svn_wc__conflict_tree_update_raise_moved
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc__conflict_tree_update_moved_away_node(svn_wc_context_t *wc_ctx,
+                                             const char *local_abspath,
+                                             svn_cancel_func_t cancel_func,
+                                             void *cancel_baton,
+                                             svn_wc_notify_func2_t notify_func,
+                                             void *notify_baton,
+                                             apr_pool_t *scratch_pool)
+{
+  svn_wc_conflict_reason_t reason;
+  svn_wc_conflict_action_t action;
+  svn_wc_operation_t operation;
+  svn_boolean_t tree_conflicted;
+  const char *src_op_root_abspath;
+  const apr_array_header_t *conflicts;
+  svn_skel_t *conflict_skel;
+
+  SVN_ERR(svn_wc__read_conflicts(&conflicts, &conflict_skel,
+                                 wc_ctx->db, local_abspath,
+                                 FALSE, /* no tempfiles */
+                                 FALSE, /* only tree conflicts */
+                                 scratch_pool, scratch_pool));
+
+  SVN_ERR(svn_wc__conflict_read_info(&operation, NULL, NULL, NULL,
+                                     &tree_conflicted, wc_ctx->db,
+                                     local_abspath, conflict_skel,
+                                     scratch_pool, scratch_pool));
+  if (!tree_conflicted)
+    return SVN_NO_ERROR;
+
+  SVN_ERR(svn_wc__conflict_read_tree_conflict(&reason, &action,
+                                              &src_op_root_abspath,
+                                              wc_ctx->db, local_abspath,
+                                              conflict_skel,
+                                              scratch_pool, scratch_pool));
+
+  /* Make sure the expected conflict is recorded. */
+  if (operation != svn_wc_operation_update &&
+      operation != svn_wc_operation_switch)
+    return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
+                             _("Unexpected conflict operation '%s' on '%s'"),
+                             svn_token__to_word(operation_map, operation),
+                             svn_dirent_local_style(local_abspath,
+                                                    scratch_pool));
+  if (reason != svn_wc_conflict_reason_moved_away)
+    return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
+                             _("Unexpected conflict reason '%s' on '%s'"),
+                             svn_token__to_word(reason_map, reason),
+                             svn_dirent_local_style(local_abspath,
+                                                    scratch_pool));
+  if (action != svn_wc_conflict_action_edit)
+    return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
+                             _("Unexpected conflict action '%s' on '%s'"),
+                             svn_token__to_word(action_map, action),
+                             svn_dirent_local_style(local_abspath,
+                                                    scratch_pool));
+
+  /* Update the moved-away conflict victim. */
+  SVN_ERR(svn_wc__db_update_moved_away_conflict_victim(wc_ctx->db,
+                                                       local_abspath,
+                                                       src_op_root_abspath,
+                                                       operation,
+                                                       action,
+                                                       reason,
+                                                       cancel_func,
+                                                       cancel_baton,
+                                                       notify_func,
+                                                       notify_baton,
+                                                       scratch_pool));
+
+  /* The conflict was marked resolved by svn_wc__db_op_raise_moved_away(). */
+  if (notify_func)
+    notify_func(notify_baton,
+                svn_wc_create_notify(local_abspath, svn_wc_notify_resolved,
+                                     scratch_pool),
+                scratch_pool);
+
+  return SVN_NO_ERROR;
+}



Mime
View raw message