Author: rhuijben
Date: Thu Sep 17 21:00:36 2015
New Revision: 1703689

URL: http://svn.apache.org/viewvc?rev=1703689&view=rev
Log:
Following up on r1703688 fix conflicts reported on merging deletes of
files that have an svn:eol-style 'CR' or 'CRLF' property.

* subversion/libsvn_client/merge.c
  (files_same_p): Use a stream in repository form instead of one with '\n'
    newlines to compare against the repository.

* subversion/tests/cmdline/merge_automatic_tests.py
  (merge_delete_crlf_file): Remove XFail marker. Tweak some comments.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1703689&r1=1703688&r2=1703689&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Sep 17 21:00:36 2015
@@ -2349,17 +2349,47 @@ files_same_p(svn_boolean_t *same,
     {
       svn_stream_t *mine_stream;
       svn_stream_t *older_stream;
-      svn_opt_revision_t working_rev = { svn_opt_revision_working, { 0 } };
+      svn_string_t *special = svn_hash_gets(working_props, SVN_PROP_SPECIAL);
+      svn_string_t *eol_style = svn_hash_gets(working_props, 
SVN_PROP_EOL_STYLE);
+      svn_string_t *keywords = svn_hash_gets(working_props, SVN_PROP_KEYWORDS);
 
       /* Compare the file content, translating 'mine' to 'normal' form. */
-      if (svn_prop_get_value(working_props, SVN_PROP_SPECIAL) != NULL)
+      if (special != NULL)
         SVN_ERR(svn_subst_read_specialfile(&mine_stream, mine_abspath,
                                            scratch_pool, scratch_pool));
       else
-        SVN_ERR(svn_client__get_normalized_stream(&mine_stream, wc_ctx,
-                                                  mine_abspath, &working_rev,
-                                                  FALSE, TRUE, NULL, NULL,
-                                                  scratch_pool, scratch_pool));
+        SVN_ERR(svn_stream_open_readonly(&mine_stream, mine_abspath,
+                                         scratch_pool, scratch_pool));
+
+      if (!special && (eol_style || keywords))
+        {
+          apr_hash_t *kw = NULL;
+          const char *eol = NULL;
+          svn_subst_eol_style_t style;
+
+          /* We used to use svn_client__get_normalized_stream() here, but
+             that doesn't work in 100% of the cases because it doesn't
+             convert EOLs to the repository form; just to '\n'.
+           */
+
+          if (eol_style)
+            {
+              svn_subst_eol_style_from_value(&style, &eol, eol_style->data);
+
+              if (style == svn_subst_eol_style_native)
+                eol = SVN_SUBST_NATIVE_EOL_STR;
+              else if (style != svn_subst_eol_style_fixed
+                       && style != svn_subst_eol_style_none)
+                return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
+            }
+
+          if (keywords)
+            SVN_ERR(svn_subst_build_keywords3(&kw, keywords->data, "", "",
+                                              "", 0, "", scratch_pool));
+
+          mine_stream = svn_subst_stream_translated(
+            mine_stream, eol, FALSE, kw, FALSE, scratch_pool);
+        }
 
       SVN_ERR(svn_stream_open_readonly(&older_stream, older_abspath,
                                        scratch_pool, scratch_pool));

Modified: subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py?rev=1703689&r1=1703688&r2=1703689&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py 
(original)
+++ subversion/trunk/subversion/tests/cmdline/merge_automatic_tests.py Thu Sep 
17 21:00:36 2015
@@ -1352,7 +1352,6 @@ def merge_to_copy_and_add(sbox):
                                      'merge', '--reintegrate', '^/A',
                                      sbox.ospath('A3'))
 
-@XFail()
 def merge_delete_crlf_file(sbox):
   "merge the deletion of a strict CRLF file"
 
@@ -1374,7 +1373,7 @@ def merge_delete_crlf_file(sbox):
 
   sbox.simple_commit('A') # r2
 
-  # Merge the addition of the file
+  # Merge the addition of the files
   svntest.actions.run_and_verify_svn(None, [],
                                      'merge', '^/A', sbox.ospath('AA'))
   sbox.simple_commit('AA') # r3
@@ -1384,6 +1383,7 @@ def merge_delete_crlf_file(sbox):
 
   sbox.simple_update('') # Make single revision r4
 
+  # And now merge the deletes
   expected_output = svntest.verify.UnorderedOutput([
     '--- Merging r3 through r4 into \'%s\':\n' % sbox.ospath('AA'),
     'D    %s\n' % sbox.ospath('AA/cr'),


Reply via email to