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 2018/06/20 09:46:05 UTC

svn commit: r1833901 - in /subversion/trunk/subversion: libsvn_client/conflicts.c tests/libsvn_client/conflicts-test.c

Author: stsp
Date: Wed Jun 20 09:46:05 2018
New Revision: 1833901

URL: http://svn.apache.org/viewvc?rev=1833901&view=rev
Log:
Fix issue #4744, "assertion failed (start_rev > end_rev)".

Do not attempt to fetch conflict details in the conflict scenario described
in issue #4744, where merge-left and merge-right URLs differ and their peg
revisions are the same. The 'merge directories' resolution option does not
handle this case yet (and is no longer offered in this case since r1833897).

However, the 'replace + merge' option works as expected.
For now this is good enough, and certainly better than an assertion failure.
Making the 'merge directories' option work is left for future work.

* subversion/libsvn_client/conflicts.c
  (conflict_tree_get_details_incoming_add): Don't return details in case
   merge-left/right URLs do not match and/or old_rev == new_rev.

* subversion/tests/libsvn_client/conflicts-test.c
  (test_merge_two_added_dirs_assertion_failure): Resolve by replace + merge
   and update test expectations accordingly.

Modified:
    subversion/trunk/subversion/libsvn_client/conflicts.c
    subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1833901&r1=1833900&r2=1833901&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Wed Jun 20 09:46:05 2018
@@ -5073,7 +5073,7 @@ conflict_tree_get_details_incoming_add(s
   const char *repos_root_url;
   svn_revnum_t old_rev;
   svn_revnum_t new_rev;
-  struct conflict_tree_incoming_add_details *details;
+  struct conflict_tree_incoming_add_details *details = NULL;
   svn_wc_operation_t operation;
 
   SVN_ERR(svn_client_conflict_get_incoming_old_repos_location(
@@ -5166,7 +5166,8 @@ conflict_tree_get_details_incoming_add(s
             }
         }
     }
-  else if (operation == svn_wc_operation_merge)
+  else if (operation == svn_wc_operation_merge &&
+           strcmp(old_repos_relpath, new_repos_relpath) == 0)
     {
       if (old_rev < new_rev)
         {
@@ -5217,7 +5218,7 @@ conflict_tree_get_details_incoming_add(s
           details->deleted_rev = SVN_INVALID_REVNUM;
           details->deleted_rev_author = NULL;
         }
-      else
+      else if (old_rev > new_rev)
         {
           /* The merge operation was a reverse-merge.
            * This addition is in fact a deletion, applied in reverse,
@@ -5257,10 +5258,6 @@ conflict_tree_get_details_incoming_add(s
           details->moves = moves;
         }
     }
-  else
-    {
-      details = NULL;
-    }
 
   conflict->tree_conflict_incoming_details = details;
 

Modified: subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c?rev=1833901&r1=1833900&r2=1833901&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Wed Jun 20 09:46:05 2018
@@ -5359,6 +5359,7 @@ test_merge_two_added_dirs_assertion_fail
     SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts, pool));
   }
 
+  /* This call used to run into an assertion failure (start_rev > end_rev). */
   SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, pool));
 
   {
@@ -5366,7 +5367,6 @@ test_merge_two_added_dirs_assertion_fail
       svn_client_conflict_option_postpone,
       svn_client_conflict_option_accept_current_wc_state,
       svn_client_conflict_option_incoming_add_ignore,
-      svn_client_conflict_option_incoming_added_dir_merge,
       svn_client_conflict_option_incoming_added_dir_replace,
       svn_client_conflict_option_incoming_added_dir_replace_and_merge,
       -1 /* end of list */
@@ -5374,21 +5374,22 @@ test_merge_two_added_dirs_assertion_fail
     SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts, pool));
   }
 
-  /* Resolve the tree conflict ... */
+  /* Resolve the tree conflict by replace + merge. */
   SVN_ERR(svn_client_conflict_tree_resolve_by_id(
-            conflict, svn_client_conflict_option_incoming_add_ignore,
+            conflict,
+            svn_client_conflict_option_incoming_added_dir_replace_and_merge,
             ctx, pool));
 
   /* Check the status. */
   SVN_ERR(svn_wc_status3(&wc_status, ctx->wc_ctx, sbox_wc_path(b, new_dir_path),
                          pool, pool));
-  SVN_TEST_INT_ASSERT(wc_status->kind, svn_node_unknown);
-  SVN_TEST_ASSERT(!wc_status->versioned);
+  SVN_TEST_INT_ASSERT(wc_status->kind, svn_node_dir);
+  SVN_TEST_ASSERT(wc_status->versioned);
   SVN_TEST_ASSERT(!wc_status->conflicted);
-  SVN_TEST_INT_ASSERT(wc_status->node_status, svn_wc_status_none);
-  SVN_TEST_INT_ASSERT(wc_status->text_status, svn_wc_status_none);
+  SVN_TEST_INT_ASSERT(wc_status->node_status, svn_wc_status_replaced);
+  SVN_TEST_INT_ASSERT(wc_status->text_status, svn_wc_status_normal);
   SVN_TEST_INT_ASSERT(wc_status->prop_status, svn_wc_status_none);
-  SVN_TEST_INT_ASSERT(wc_status->actual_kind, svn_node_none);
+  SVN_TEST_INT_ASSERT(wc_status->actual_kind, svn_node_dir);
 
   return SVN_NO_ERROR;
 }
@@ -5485,8 +5486,8 @@ static struct svn_test_descriptor_t test
                        "merge incoming dir move across branches"),
     SVN_TEST_OPTS_PASS(test_update_incoming_delete_locally_deleted_file,
                        "update incoming delete to deleted file (#4739)"),
-    SVN_TEST_OPTS_XFAIL(test_merge_two_added_dirs_assertion_failure,
-                        "merge two added dirs assertion failure (#4744)"),
+    SVN_TEST_OPTS_PASS(test_merge_two_added_dirs_assertion_failure,
+                       "merge two added dirs assertion failure (#4744)"),
     SVN_TEST_NULL
   };