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/11/28 12:12:43 UTC

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

Author: stsp
Date: Mon Nov 28 12:12:43 2016
New Revision: 1771722

URL: http://svn.apache.org/viewvc?rev=1771722&view=rev
Log:
Fix merging of properties while resolving an incoming file move during merge.

* subversion/libsvn_client/conflicts.c
  (resolve_incoming_move_file_text_merge): Get ancestor props and pass them
   to svn_wc_merge5(). Build the propdiff between move-target and victim in
   the right direction.

* subversion/tests/libsvn_client/conflicts-test.c
  (test_merge_incoming_move_file_prop_merge_conflict): Comment tweaks.
  (test_funcs): Switch "incoming move file prop merge conflict" test to PASS.

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=1771722&r1=1771721&r2=1771722&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Mon Nov 28 12:12:43 2016
@@ -6874,6 +6874,7 @@ resolve_incoming_move_file_text_merge(sv
   const char *wc_tmpdir;
   const char *ancestor_abspath;
   svn_stream_t *ancestor_stream;
+  apr_hash_t *ancestor_props;
   apr_hash_t *victim_props;
   apr_hash_t *move_target_props;
   const char *ancestor_url;
@@ -6886,6 +6887,7 @@ resolve_incoming_move_file_text_merge(sv
   apr_array_header_t *possible_moved_to_abspaths;
   const char *moved_to_abspath;
   const char *incoming_abspath;
+  apr_hash_index_t *hi;
 
   local_abspath = svn_client_conflict_get_local_abspath(conflict);
   operation = svn_client_conflict_get_operation(conflict);
@@ -6940,7 +6942,17 @@ resolve_incoming_move_file_text_merge(sv
                                                scratch_pool, scratch_pool));
   SVN_ERR(svn_ra_get_file(ra_session, "", incoming_old_pegrev,
                           ancestor_stream, NULL, /* fetched_rev */
-                          NULL /* we don't need these props */, scratch_pool));
+                          &ancestor_props, scratch_pool));
+  /* Delete entry and wc props from the returned set of properties. */
+  for (hi = apr_hash_first(scratch_pool, ancestor_props);
+       hi != NULL;
+       hi = apr_hash_next(hi))
+    {
+      const char *propname = apr_hash_this_key(hi);
+
+      if (!svn_wc_is_normal_prop(propname))
+        svn_hash_sets(ancestor_props, propname, NULL);
+    }
 
   /* Close stream to flush ancestor file to disk. */
   SVN_ERR(svn_stream_close(ancestor_stream));
@@ -6978,7 +6990,7 @@ resolve_incoming_move_file_text_merge(sv
     goto unlock_wc;
 
   /* Create a property diff for the files. */
-  err = svn_prop_diffs(&propdiffs, victim_props, move_target_props,
+  err = svn_prop_diffs(&propdiffs, move_target_props, victim_props,
                        scratch_pool);
   if (err)
     goto unlock_wc;
@@ -7041,7 +7053,7 @@ resolve_incoming_move_file_text_merge(sv
                       NULL, NULL, /* conflict versions */
                       FALSE, /* dry run */
                       NULL, NULL, /* diff3_cmd, merge_options */
-                      NULL, propdiffs,
+                      ancestor_props, propdiffs,
                       NULL, NULL, /* conflict func/baton */
                       NULL, NULL, /* don't allow user to cancel here */
                       scratch_pool);

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=1771722&r1=1771721&r2=1771722&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Mon Nov 28 12:12:43 2016
@@ -3501,7 +3501,7 @@ test_merge_incoming_move_file_prop_merge
   opt_rev.value.number = SVN_INVALID_REVNUM;
   SVN_ERR(svn_test__create_client_ctx(&ctx, b, pool));
 
-  /* Merge "A" to "A1". */
+  /* Merge "trunk" to "branch". */
   SVN_ERR(svn_client_merge_peg5(svn_path_url_add_component2(b->repos_url, "A",
                                                             pool),
                                 NULL, &opt_rev, sbox_wc_path(b, "A1"),
@@ -3549,10 +3549,7 @@ test_merge_incoming_move_file_prop_merge
             conflict, svn_client_conflict_option_incoming_move_file_text_merge,
             ctx, pool));
 
-  /* We should now have a property conflict in the file "mu-moved".
-   *
-   * XFAIL: Currently, there is no property conflict.
-   */
+  /* We should now have a property conflict in the file "mu-moved". */
   SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, "A1/mu-moved"),
                                   ctx, pool, pool));
   SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
@@ -3764,8 +3761,8 @@ static struct svn_test_descriptor_t test
                        "update incoming dir move with nested file move"),
     SVN_TEST_OPTS_PASS(test_update_incoming_added_file_text_merge,
                        "update incoming add file text merge"),
-    SVN_TEST_OPTS_XFAIL(test_merge_incoming_move_file_prop_merge_conflict,
-                        "merge incoming move file merge with prop conflict"),
+    SVN_TEST_OPTS_PASS(test_merge_incoming_move_file_prop_merge_conflict,
+                       "merge incoming move file merge with prop conflict"),
     SVN_TEST_OPTS_XFAIL(test_merge_incoming_move_file_text_merge_keywords,
                         "merge incoming move file merge with keywords"),
     SVN_TEST_NULL