You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/01/30 15:20:36 UTC

svn commit: r1727699 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/resolved.c svn/conflict-callbacks.c

Author: stsp
Date: Sat Jan 30 14:20:36 2016
New Revision: 1727699

URL: http://svn.apache.org/viewvc?rev=1727699&view=rev
Log:
Create distinct conflict option IDs for our current tree conflict resolution
options (there are only 2 options which actually resolve a tree conflict).

The new options are only used in libsvn_client and 'svn' for now. The
current libsvn_wc interfaces still force us to map conflict option IDs to
svn_wc_conflict_choice_t. As a side effect, --accept mine-conflict still
works with these tree conflicts, but that may change later (we'll need a
different system than a single --accept option to resolve arbitrary tree
conflicts in a non-interactive way).

* subversion/include/svn_client.h
  (svn_client_conflict_option_update_move_destination,
   svn_client_conflict_option_update_any_moved_away_children): Declare.
  (svn_client_conflict_option_id_to_wc_conflict_choice): Declare. This is a
   temorary interface which maps option ID to legacy conflict choice.

* subversion/libsvn_client/resolved.c
  (conflict_option_id_to_wc_conflict_choice): Rename to ...
  (svn_client_conflict_option_id_to_wc_conflict_choice): ... this and expose as
   a temporary public API function. Map the new option IDs to the legacy
   conflict choice 'mine-conflict' so libsvn_wc will still resolve these
   conflicts correctly.
  (resolve_conflict): Update caller.
  (svn_client_conflict_tree_get_resolution_options): Assign the new option IDs
   to their respective tree conflict options.

* subversion/svn/conflict-callbacks.c
  (builtin_resolver_options): Add new options IDs. Use code "u" for them,
   a mnemonic for "update", instead of "mc" ("mine-conflict").
  (conflict_option_id_to_wc_conflict_choice): Remove. This was a copy of
   the same function in libsvn_client.
  (mark_conflict_resolved): Use the new
   svn_client_conflict_option_id_to_wc_conflict_choice() interface.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/resolved.c
    subversion/trunk/subversion/svn/conflict-callbacks.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1727699&r1=1727698&r2=1727699&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Sat Jan 30 14:20:36 2016
@@ -4382,7 +4382,8 @@ typedef struct svn_client_conflict_optio
  */
 typedef enum svn_client_conflict_option_id_t {
 
-  /* These values intentionally mirror svn_wc_conflict_choice_t. */
+  /* Options for text and property conflicts.
+   * These values intentionally mirror svn_wc_conflict_choice_t. */
   svn_client_conflict_option_undefined = -1, /* for private use only */
   svn_client_conflict_option_postpone = 0,
   svn_client_conflict_option_base_text,
@@ -4391,12 +4392,31 @@ typedef enum svn_client_conflict_option_
   svn_client_conflict_option_incoming_text_where_conflicted,
   svn_client_conflict_option_working_text_where_conflicted,
   svn_client_conflict_option_merged_text,
-  svn_client_conflict_option_unspecified
+  svn_client_conflict_option_unspecified,
   /* Values derived from svn_wc_conflict_choice_t end here. */
 
+  /* Tree conflict resolution options start here. */
+
+  /* Options for local move vs incoming edit on update. */
+  svn_client_conflict_option_update_move_destination,
+
+  /* Options for local delete/replace vs incoming edit on update. */
+  svn_client_conflict_option_update_any_moved_away_children,
+
 } svn_client_conflict_option_id_t;
 
 /**
+ * Map an option ID to a legacy conflict choice.
+ * This is a temporary API. It is currently still needed to mark
+ * conflicts as resolved using libsvn_wc interfaces.
+ *
+ * @since New in 1.10.
+ */
+svn_wc_conflict_choice_t
+svn_client_conflict_option_id_to_wc_conflict_choice(
+  svn_client_conflict_option_id_t option_id);
+
+/**
  * Set a merged property value on @a option to @a merged_propval.
  * 
  * Setting the merged value is required before resolving the property

Modified: subversion/trunk/subversion/libsvn_client/resolved.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/resolved.c?rev=1727699&r1=1727698&r2=1727699&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/resolved.c (original)
+++ subversion/trunk/subversion/libsvn_client/resolved.c Sat Jan 30 14:20:36 2016
@@ -208,8 +208,8 @@ struct svn_client_conflict_option_t
  * Return svn_wc_conflict_choose_undefined if no corresponding
  * legacy conflict choice exists.
  */
-static svn_wc_conflict_choice_t
-conflict_option_id_to_wc_conflict_choice(
+svn_wc_conflict_choice_t
+svn_client_conflict_option_id_to_wc_conflict_choice(
   svn_client_conflict_option_id_t option_id)
 {
 
@@ -242,6 +242,12 @@ conflict_option_id_to_wc_conflict_choice
       case svn_client_conflict_option_unspecified:
         return svn_wc_conflict_choose_unspecified;
 
+      /* ### These options are mapped to conflict_choice_t for now
+       * ### because libsvn_wc does not offer an interface for them. */
+      case svn_client_conflict_option_update_move_destination:
+      case svn_client_conflict_option_update_any_moved_away_children:
+        return svn_wc_conflict_choose_mine_conflict;
+
       default:
         break;
     }
@@ -686,7 +692,8 @@ resolve_conflict(svn_client_conflict_opt
   const char *lock_abspath;
   svn_error_t *err;
 
-  conflict_choice = conflict_option_id_to_wc_conflict_choice(option_id);
+  conflict_choice =
+    svn_client_conflict_option_id_to_wc_conflict_choice(option_id);
   SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
                                                  local_abspath,
                                                  scratch_pool, scratch_pool));
@@ -1042,7 +1049,8 @@ svn_client_conflict_tree_get_resolution_
       reason = svn_client_conflict_get_local_change(conflict);
       if (reason == svn_wc_conflict_reason_moved_away)
         {
-          option->id = svn_client_conflict_option_working_text_where_conflicted;
+          option->id =
+            svn_client_conflict_option_update_move_destination;
           option->description =
             _("apply incoming changes to move destination");
         }
@@ -1055,7 +1063,7 @@ svn_client_conflict_tree_get_resolution_
               svn_node_dir)
             {
               option->id =
-                svn_client_conflict_option_working_text_where_conflicted;
+                svn_client_conflict_option_update_any_moved_away_children;
               option->description =
                 _("prepare for updating moved-away children, if any");
             }

Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1727699&r1=1727698&r2=1727699&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Sat Jan 30 14:20:36 2016
@@ -407,6 +407,14 @@ static const resolver_option_t builtin_r
   { "p",  N_("postpone"),         NULL,
                                   svn_client_conflict_option_postpone,
                                   SVN_CL__ACCEPT_POSTPONE },
+
+  /* These options use the same code since they only occur in
+   * distinct conflict scenarios. */
+  { "u", N_("update move destination"),    NULL,
+    svn_client_conflict_option_update_move_destination },
+  { "u", N_("update any moved-away children"), NULL,
+    svn_client_conflict_option_update_any_moved_away_children },
+
   { NULL }
 };
 
@@ -1676,52 +1684,6 @@ resolve_conflict_interactively(svn_boole
   return SVN_NO_ERROR;
 }
 
-/*
- * Return a legacy conflict choice corresponding to OPTION_ID.
- * Return svn_wc_conflict_choose_undefined if no corresponding
- * legacy conflict choice exists.
- */
-static svn_wc_conflict_choice_t
-conflict_option_id_to_wc_conflict_choice(
-  svn_client_conflict_option_id_t option_id)
-{
-
-  switch (option_id)
-    {
-      case svn_client_conflict_option_undefined:
-        return svn_wc_conflict_choose_undefined;
-
-      case svn_client_conflict_option_postpone:
-        return svn_wc_conflict_choose_postpone;
-
-      case svn_client_conflict_option_base_text:
-        return svn_wc_conflict_choose_base;
-
-      case svn_client_conflict_option_incoming_text:
-        return svn_wc_conflict_choose_theirs_full;
-
-      case svn_client_conflict_option_working_text:
-        return svn_wc_conflict_choose_mine_full;
-
-      case svn_client_conflict_option_incoming_text_where_conflicted:
-        return svn_wc_conflict_choose_theirs_conflict;
-
-      case svn_client_conflict_option_working_text_where_conflicted:
-        return svn_wc_conflict_choose_mine_conflict;
-
-      case svn_client_conflict_option_merged_text:
-        return svn_wc_conflict_choose_merged;
-
-      case svn_client_conflict_option_unspecified:
-        return svn_wc_conflict_choose_unspecified;
-
-      default:
-        break;
-    }
-
-  return svn_wc_conflict_choose_undefined;
-}
-
 /* Mark CONFLICT as resolved to resolution option with ID OPTION_ID.
  * If TEXT_CONFLICTED is true, resolve text conflicts described by CONFLICT.
  * IF PROPNAME is not NULL, mark the conflict in the specified property as
@@ -1759,7 +1721,7 @@ mark_conflict_resolved(svn_client_confli
   err = svn_wc_resolved_conflict5(
           ctx->wc_ctx, local_abspath, svn_depth_empty, /* ??? */
           text_conflicted, propname, tree_conflicted,
-          conflict_option_id_to_wc_conflict_choice(option_id),
+          svn_client_conflict_option_id_to_wc_conflict_choice(option_id),
           ctx->cancel_func, ctx->cancel_baton,
           ctx->notify_func2, ctx->notify_baton2,
           scratch_pool);