You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2013/05/22 21:33:16 UTC

svn commit: r1485363 - in /subversion/branches/1.7.x: ./ STATUS subversion/libsvn_client/blame.c subversion/tests/cmdline/blame_tests.py

Author: svn-role
Date: Wed May 22 19:33:16 2013
New Revision: 1485363

URL: http://svn.apache.org/r1485363
Log:
Merge the r1434128 group from trunk:

 * r1434128, r1434435, r1434476
   Fix issue #4034, 'blame on files with non-native eol-style sees every
   line as modified'.
   Justification:
     When blaming to the working copy instead of the base version eol styles
     all other styles than those with "\n" repository form show up as
     entirely changed.
   Votes:
     +1: rhuijben, stsp, breser

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/libsvn_client/blame.c
    subversion/branches/1.7.x/subversion/tests/cmdline/blame_tests.py

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1434128,1434435,1434476

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1485363&r1=1485362&r2=1485363&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Wed May 22 19:33:16 2013
@@ -176,16 +176,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1434128, r1434435, r1434476
-   Fix issue #4034, 'blame on files with non-native eol-style sees every
-   line as modified'.
-   Justification:
-     When blaming to the working copy instead of the base version eol styles
-     all other styles than those with "\n" repository form show up as
-     entirely changed.
-   Votes:
-     +1: rhuijben, stsp, breser
-
  * r1434750
    Resolve regression in 'svn status -u' output when running on externals.
    Without this patch the paths in directory externals are shown as absolute

Modified: subversion/branches/1.7.x/subversion/libsvn_client/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_client/blame.c?rev=1485363&r1=1485362&r2=1485363&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_client/blame.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_client/blame.c Wed May 22 19:33:16 2013
@@ -675,28 +675,41 @@ svn_client_blame5(const char *target,
       SVN_ERR(svn_wc_status3(&status, ctx->wc_ctx, target_abspath_or_url, pool,
                              pool));
 
-      if (status->text_status != svn_wc_status_normal)
+      if (status->text_status != svn_wc_status_normal
+          || (status->prop_status != svn_wc_status_normal
+              && status->prop_status != svn_wc_status_none))
         {
-          apr_hash_t *props;
           svn_stream_t *wcfile;
-          svn_string_t *keywords;
           svn_stream_t *tempfile;
+          svn_opt_revision_t rev;
+          svn_boolean_t normalize_eols = FALSE;
           const char *temppath;
-          apr_hash_t *kw = NULL;
 
-          SVN_ERR(svn_wc_prop_list2(&props, ctx->wc_ctx, target_abspath_or_url,
-                                    pool, pool));
-          SVN_ERR(svn_stream_open_readonly(&wcfile, target, pool, pool));
-
-          keywords = apr_hash_get(props, SVN_PROP_KEYWORDS,
-                                  APR_HASH_KEY_STRING);
+          if (status->prop_status != svn_wc_status_none)
+            {
+              const svn_string_t *eol_style;
+              SVN_ERR(svn_wc_prop_get2(&eol_style, ctx->wc_ctx,
+                                       target_abspath_or_url,
+                                       SVN_PROP_EOL_STYLE,
+                                       pool, pool));
+
+              if (eol_style)
+                {
+                  svn_subst_eol_style_t style;
+                  const char *eol;
+                  svn_subst_eol_style_from_value(&style, &eol, eol_style->data);
 
-          if (keywords)
-            SVN_ERR(svn_subst_build_keywords2(&kw, keywords->data, NULL, NULL,
-                                              0, NULL, pool));
+                  normalize_eols = (style == svn_subst_eol_style_native);
+                }
+            }
 
-          wcfile = svn_subst_stream_translated(wcfile, "\n", TRUE, kw, FALSE,
-                                               pool);
+          rev.kind = svn_opt_revision_working;
+          SVN_ERR(svn_client__get_normalized_stream(&wcfile, ctx->wc_ctx,
+                                                    target_abspath_or_url, &rev,
+                                                    FALSE, normalize_eols,
+                                                    ctx->cancel_func,
+                                                    ctx->cancel_baton,
+                                                    pool, pool));
 
           SVN_ERR(svn_stream_open_unique(&tempfile, &temppath, NULL,
                                          svn_io_file_del_on_pool_cleanup,

Modified: subversion/branches/1.7.x/subversion/tests/cmdline/blame_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/tests/cmdline/blame_tests.py?rev=1485363&r1=1485362&r2=1485363&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/tests/cmdline/blame_tests.py (original)
+++ subversion/branches/1.7.x/subversion/tests/cmdline/blame_tests.py Wed May 22 19:33:16 2013
@@ -858,6 +858,98 @@ def blame_multiple_targets(sbox):
   multiple_wc_targets()
   multiple_url_targets()
 
+@Issue(4034)
+def blame_eol_handling(sbox):
+  "blame it on the eol handling"
+
+  sbox.build()
+
+  if os.name == 'nt':
+    native_eol = '\r\n'
+  else:
+    native_eol = '\n'
+
+  for eol, prop, rev in [ ('\r',   'CR',         2),
+                          ('\n',   'LF',         4),
+                          ('\r\n', 'CRLF',       6),
+                          (native_eol, 'native', 8) ]:
+
+    f1 = sbox.ospath('blame-%s' % prop)
+    f2 = sbox.ospath('blame-%s-prop' % prop)
+
+    file_data = 'line 1 ' + eol + \
+                'line 2 ' + eol + \
+                'line 3 ' + eol + \
+                'line 4 ' + eol + \
+                'line 5 ' + eol
+
+    svntest.main.file_write(f1, file_data, mode='wb')
+    svntest.main.file_write(f2, file_data, mode='wb')
+
+    sbox.simple_add('blame-%s' % prop,
+                    'blame-%s-prop' % prop)
+    sbox.simple_propset('svn:eol-style', prop, 'blame-%s-prop' % prop)
+    sbox.simple_commit()
+
+    file_data = 'line 1 ' + eol + \
+                'line 2 ' + eol + \
+                'line 2a' + eol + \
+                'line 3 ' + eol + \
+                'line 4 ' + eol + \
+                'line 4a' + eol + \
+                'line 5 ' + eol
+
+    svntest.main.file_write(f1, file_data, mode='wb')
+    svntest.main.file_write(f2, file_data, mode='wb')
+
+    sbox.simple_commit()
+
+    expected_output = [
+        '     %d    jrandom line 1 \n' % rev,
+        '     %d    jrandom line 2 \n' % rev,
+        '     %d    jrandom line 2a\n' % (rev + 1),
+        '     %d    jrandom line 3 \n' % rev,
+        '     %d    jrandom line 4 \n' % rev,
+        '     %d    jrandom line 4a\n' % (rev + 1),
+        '     %d    jrandom line 5 \n' % rev,
+    ]
+
+    svntest.actions.run_and_verify_svn(f1 + '-base', expected_output, [],
+                                       'blame', f1)
+
+    svntest.actions.run_and_verify_svn(f2 + '-base', expected_output, [],
+                                       'blame', f2)
+
+    file_data = 'line 1 ' + eol + \
+                'line 2 ' + eol + \
+                'line 2a' + eol + \
+                'line 3 ' + eol + \
+                'line 3b' + eol + \
+                'line 4 ' + eol + \
+                'line 4a' + eol + \
+                'line 5 ' + eol
+
+    svntest.main.file_write(f1, file_data, mode='wb')
+    svntest.main.file_write(f2, file_data, mode='wb')
+
+    expected_output = [
+        '     %d    jrandom line 1 \n' % rev,
+        '     %d    jrandom line 2 \n' % rev,
+        '     %d    jrandom line 2a\n' % (rev + 1),
+        '     %d    jrandom line 3 \n' % rev,
+         '     -          - line 3b\n',
+        '     %d    jrandom line 4 \n' % rev,
+        '     %d    jrandom line 4a\n' % (rev + 1),
+        '     %d    jrandom line 5 \n' % rev,
+    ]
+
+    svntest.actions.run_and_verify_svn(f1 + '-modified', expected_output, [],
+                                       'blame', f1)
+
+    svntest.actions.run_and_verify_svn(f2 + '-modified', expected_output, [],
+                                       'blame', f2)
+
+
 ########################################################################
 # Run the tests
 
@@ -880,6 +972,7 @@ test_list = [ None,
               blame_output_after_merge,
               merge_sensitive_blame_and_empty_mergeinfo,
               blame_multiple_targets,
+              blame_eol_handling,
              ]
 
 if __name__ == '__main__':