Author: philip
Date: Tue Jun 12 12:08:04 2012
New Revision: 1349288

URL: http://svn.apache.org/viewvc?rev=1349288&view=rev
Log:
Fix issue 4128: no conflict for identical files.

* subversion/libsvn_wc/merge.c
  (merge_file_trivial): Successful report merge_unchanged when incoming
   file is identical to existing, locally modified file.

* subversion/tests/cmdline/update_tests.py
  (update_binary_file_3): Tweak expectations, remove XFAIL marker.

Patch by: Markus Schaber <[email protected]>

Modified:
    subversion/trunk/subversion/libsvn_wc/merge.c
    subversion/trunk/subversion/tests/cmdline/update_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/merge.c?rev=1349288&r1=1349287&r2=1349288&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Tue Jun 12 12:08:04 2012
@@ -929,6 +929,8 @@ maybe_resolve_conflicts(svn_skel_t **wor
  * 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,23 @@ merge_file_trivial(svn_skel_t **work_ite
 
       return SVN_NO_ERROR;
     }
+  else
+    {
+      /* Check whether the existing version equals the right side. If it 
+       * does, the locally existing, changed file equals the incoming
+       * file, so there is no conflict. For binary files, we historically
+       * conflicted them needlessly, while merge_text_file figured it out 
+       * eventually and returned svn_wc_merge_unchanged for them, which
+       * is what we do here. */
+      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_unchanged;
+          return SVN_NO_ERROR;
+        }
+    }
 
   *merge_outcome = svn_wc_merge_no_merge;
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1349288&r1=1349287&r2=1349288&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Tue Jun 12 
12:08:04 2012
@@ -310,7 +310,6 @@ def update_binary_file_2(sbox):
 
 #----------------------------------------------------------------------
 
-@XFail()
 @Issue(4128)
 def update_binary_file_3(sbox):
   "update locally modified file to equal versions"
@@ -367,7 +366,7 @@ def update_binary_file_3(sbox):
 
   # Create expected output tree for an update to rev 2.
   expected_output = svntest.wc.State(wc_dir, {
-    'A/theta' : Item(status='  '),
+    'A/theta' : Item(status='G '),
     })
 
   # Create expected disk tree for the update


Reply via email to