You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2013/02/08 12:40:40 UTC

svn commit: r1443948 - in /subversion/trunk/subversion/libsvn_wc: conflicts.c wc_db_update_move.c

Author: philip
Date: Fri Feb  8 11:40:40 2013
New Revision: 1443948

URL: http://svn.apache.org/r1443948
Log:
Make move-update bail-out when encountering a merge conflict.

* subversion/libsvn_wc/wc_db_update_move.c
  (mark_tree_conflict, get_tc_info): Ensure an existing tree-conflict
   is an update or switch operation.

* subversion/libsvn_wc/conflicts.c
  (resolve_conflict_on_node): Check the conflict operation earlier
   to avoid attempting move-update actions on merge conflicts.

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

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1443948&r1=1443947&r2=1443948&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Fri Feb  8 11:40:40 2013
@@ -2615,30 +2615,25 @@ resolve_conflict_on_node(svn_boolean_t *
                                                   conflicts,
                                                   scratch_pool, scratch_pool));
 
-      if (reason == svn_wc_conflict_reason_deleted)
+      if (operation == svn_wc_operation_update
+          || operation == svn_wc_operation_switch)
         {
-          /* ### FIXME.  At the moment this is a separate transaction
-             ### but it should somehow be combined with the transaction
-             ### in svn_wc__db_op_mark_resolved.  Perhaps move this
-             ### functionality into that function?  Perhaps have this
-             ### function generate "raise conflict" workqueue items? */
-          if (conflict_choice == svn_wc_conflict_choose_merged)
+          if (reason == svn_wc_conflict_reason_deleted)
             {
-              SVN_ERR(svn_wc__db_resolve_delete_raise_moved_away(db,
-                                                                 local_abspath,
-                                                                 scratch_pool));
-              *did_resolve = TRUE;
+              if (conflict_choice == svn_wc_conflict_choose_merged)
+                {
+                  SVN_ERR(svn_wc__db_resolve_delete_raise_moved_away(
+                            db, local_abspath, scratch_pool));
+                  *did_resolve = TRUE;
+                }
             }
-        }
-      else if (reason == svn_wc_conflict_reason_moved_away)
-        {
-          /* After updates, we can resolve local moved-away vs. any incoming
-           * change, either by updating the moved-away node (mine-conflict)
-           * or by breaking the move (theirs-conflict). */
-          if (conflict_choice == svn_wc_conflict_choose_mine_conflict)
+          else if (reason == svn_wc_conflict_reason_moved_away)
             {
-              if (operation == svn_wc_operation_update ||
-                  operation == svn_wc_operation_switch)
+              /* After updates, we can resolve local moved-away
+               * vs. any incoming change, either by updating the
+               * moved-away node (mine-conflict) or by breaking the
+               * move (theirs-conflict). */
+              if (conflict_choice == svn_wc_conflict_choose_mine_conflict)
                 {
                   SVN_ERR(svn_wc__db_update_moved_away_conflict_victim(
                             &work_items,
@@ -2648,19 +2643,21 @@ resolve_conflict_on_node(svn_boolean_t *
                             scratch_pool, scratch_pool));
                   *did_resolve = TRUE;
                 }
-            }
-          else if (conflict_choice == svn_wc_conflict_choose_theirs_conflict ||
-                   conflict_choice == svn_wc_conflict_choose_merged)
-            {
-              /* We must break the move even if the user accepts the current
-               * working copy state (choose_merged) instead of updating the
-               * move. Else the move would be left in an invalid state. */
-
-              /* ### As above, this should also be combined with
-                 ### svn_wc__db_op_mark_resolved. */
-              SVN_ERR(svn_wc__db_resolve_break_moved_away(db, local_abspath,
-                                                          scratch_pool));
-              *did_resolve = TRUE;
+              else if (conflict_choice == svn_wc_conflict_choose_theirs_conflict
+                       || conflict_choice == svn_wc_conflict_choose_merged)
+                {
+                  /* We must break the move even if the user accepts
+                   * the current working copy state (choose_merged)
+                   * instead of updating the move. Else the move would
+                   * be left in an invalid state. */
+
+                  /* ### This breaks the move but leaves the conflict
+                     ### involving the move until
+                     ### svn_wc__db_op_mark_resolved. */
+                  SVN_ERR(svn_wc__db_resolve_break_moved_away(db, local_abspath,
+                                                              scratch_pool));
+                  *did_resolve = TRUE;
+                }
             }
         }
 

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=1443948&r1=1443947&r2=1443948&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Fri Feb  8 11:40:40 2013
@@ -260,21 +260,34 @@ mark_tree_conflict(struct tc_editor_bato
 
   if (conflict)
     {
-      svn_wc_conflict_reason_t existing_reason;
-      svn_wc_conflict_action_t existing_action;
-      const char *existing_abspath;
-
-      err = svn_wc__conflict_read_tree_conflict(&existing_reason,
-                                                &existing_action,
-                                                &existing_abspath,
-                                                b->db, b->wcroot->abspath,
-                                                conflict,
-                                                scratch_pool, scratch_pool);
-      if (err && err->apr_err != SVN_ERR_WC_MISSING)
-        return err;
+      svn_wc_operation_t operation;
+      svn_boolean_t tree_conflicted;
 
-      if (!err)
+      SVN_ERR(svn_wc__conflict_read_info(&operation, NULL, NULL, NULL,
+                                         &tree_conflicted,
+                                         b->db, b->wcroot->abspath, conflict,
+                                         scratch_pool, scratch_pool));
+
+      if (operation != svn_wc_operation_update
+          && operation != svn_wc_operation_switch)
+        return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
+                                 _("'%s' already in conflict"),
+                                 svn_dirent_local_style(local_relpath,
+                                                        scratch_pool));
+
+      if (tree_conflicted)
         {
+          svn_wc_conflict_reason_t existing_reason;
+          svn_wc_conflict_action_t existing_action;
+          const char *existing_abspath;
+
+          SVN_ERR(svn_wc__conflict_read_tree_conflict(&existing_reason,
+                                                      &existing_action,
+                                                      &existing_abspath,
+                                                      b->db, b->wcroot->abspath,
+                                                      conflict,
+                                                      scratch_pool,
+                                                      scratch_pool));
           if (reason != existing_reason
               || action != existing_action
               || (reason == svn_wc_conflict_reason_moved_away
@@ -289,9 +302,6 @@ mark_tree_conflict(struct tc_editor_bato
           /* Already a suitable tree-conflict. */
           return SVN_NO_ERROR;
         }
-
-      /* Not a tree-conflict. */
-      svn_error_clear(err);
     }
   else
     conflict = svn_wc__conflict_skel_create(scratch_pool);
@@ -1330,7 +1340,9 @@ get_tc_info(svn_wc_operation_t *operatio
                                      db, src_abspath,
                                      conflict_skel, result_pool,
                                      scratch_pool));
-  if (!tree_conflicted)
+  if ((*operation != svn_wc_operation_update
+       && *operation != svn_wc_operation_switch)
+      || !tree_conflicted)
     return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
                              _("'%s' is not a tree-conflict victim"),
                              svn_dirent_local_style(src_abspath,