Hi, Martin,
Von: MARTIN PHILIP [codematters_at_ntlworld.com]
>> What about removing XFail from update_binary_file_3?
> The code path you are changing is for all files, not just binary files,
> so it affects all merges.  The documentation for merge_file_trivial
> needs to be updated.
Thanks for your comments!
To be honest, after thinking twice, I'm not sure whether my change actually changes user-visible behaviour for non-binary files. My assumption was that merge_text_file() call following the merge_file_trivial() eventually produces the same result in that case, just using a different path to arrive there.
Here's the second iteration:
[[[
libsvn_wc: no conflict for identical files
[ in subversion/libsvn_wc ]
* merge.c
  (merge_file_trivial): Successful report merged when incoming file is identical to existing, locally modified file.
[ in subversion/tests/cmdline ]
 * update_tests.py
  (update_binary_file_3): Remove XFAIL marker.
]]]
Index: subversion/libsvn_wc/merge.c
===================================================================
--- subversion/libsvn_wc/merge.c	(revision 1348784)
+++ subversion/libsvn_wc/merge.c	(working copy)
@@ -929,6 +929,8 @@
  * The merge is trivial if the file at LEFT_ABSPATH equals the detranslated
  * form of the target at DETRANSLATED_TARGET_ABSPATH, because in this case
  * the content of RIGHT_ABSPATH can be copied to the target.
+ * Another trivial case is if DETRANSLATED_TARGET_ABSPATH is identical to 
+ * RIGHT_ABSPATH - we can just accept the existing content as merge result.
  * On success, set *MERGE_OUTCOME to SVN_WC_MERGE_MERGED in case the
  * target was changed, or to SVN_WC_MERGE_UNCHANGED if the target was not
  * changed. Install work queue items allocated in RESULT_POOL in *WORK_ITEMS.
@@ -992,6 +994,20 @@
 
       return SVN_NO_ERROR;
     }
+  else
+    {
+      /* Check whether the existing version equals the right side.
+       * If it does, the local changes reflect the same state as the incoming
+	   * file, so there is no conflict. But as the state of the file actually
+	   * changes, we intentionally report this as a successful merge. */
+      SVN_ERR(svn_io_files_contents_same_p(&same_contents, detranslated_target_abspath,
+                                           right_abspath, scratch_pool));
+	  if (same_contents)
+	    {		  
+          *merge_outcome = svn_wc_merge_merged;
+		  return SVN_NO_ERROR;
+	    }
+    }
 
   *merge_outcome = svn_wc_merge_no_merge;
   return SVN_NO_ERROR;
Index: subversion/tests/cmdline/update_tests.py
===================================================================
--- subversion/tests/cmdline/update_tests.py	(revision 1348784)
+++ subversion/tests/cmdline/update_tests.py	(working copy)
@@ -310,7 +310,6 @@
 
 #----------------------------------------------------------------------
 
-_at_XFail()
 @Issue(4128)
 def update_binary_file_3(sbox):
   "update locally modified file to equal versions"
Received on 2012-06-11 16:00:57 CEST