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 2012/05/22 19:06:32 UTC

svn commit: r1341563 - in /subversion/branches/1.7.x-issue4153: ./ subversion/libsvn_client/diff.c

Author: stsp
Date: Tue May 22 17:06:32 2012
New Revision: 1341563

URL: http://svn.apache.org/viewvc?rev=1341563&view=rev
Log:
On the 1.7.x-issue4153 branch, merge r1341562 from trunk (clean merge).

Modified:
    subversion/branches/1.7.x-issue4153/   (props changed)
    subversion/branches/1.7.x-issue4153/subversion/libsvn_client/diff.c

Propchange: subversion/branches/1.7.x-issue4153/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1341560

Modified: subversion/branches/1.7.x-issue4153/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4153/subversion/libsvn_client/diff.c?rev=1341563&r1=1341562&r2=1341563&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4153/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/1.7.x-issue4153/subversion/libsvn_client/diff.c Tue May 22 17:06:32 2012
@@ -2236,6 +2236,7 @@ diff_repos_wc_file_target(const char *ta
 {
   const char *file1_abspath;
   svn_stream_t *file1_content;
+  svn_stream_t *file2_content;
   apr_hash_t *file1_props = NULL;
   apr_hash_t *file2_props;
   svn_boolean_t is_copy = FALSE;
@@ -2263,7 +2264,6 @@ diff_repos_wc_file_target(const char *ta
   if (diff_with_base)
     {
       svn_stream_t *pristine_content;
-      svn_stream_t *file2_content;
 
       SVN_ERR(svn_wc_get_pristine_props(&file2_props, ctx->wc_ctx,
                                         file2_abspath, scratch_pool,
@@ -2286,8 +2286,47 @@ diff_repos_wc_file_target(const char *ta
                                scratch_pool));
     }
   else
-    SVN_ERR(svn_wc_prop_list2(&file2_props, ctx->wc_ctx, file2_abspath,
-                              scratch_pool, scratch_pool));
+    {
+      apr_hash_t *keywords = NULL;
+      svn_string_t *keywords_prop;
+      svn_subst_eol_style_t eol_style;
+      const char *eol_str;
+
+      SVN_ERR(svn_wc_prop_list2(&file2_props, ctx->wc_ctx, file2_abspath,
+                                scratch_pool, scratch_pool));
+
+      /* We might have to create a normalised version of the working file. */
+      svn_subst_eol_style_from_value(&eol_style, &eol_str,
+                                     apr_hash_get(file2_props,
+                                                  SVN_PROP_EOL_STYLE,
+                                                  APR_HASH_KEY_STRING));
+      keywords_prop = apr_hash_get(file2_props, SVN_PROP_KEYWORDS,
+                                   APR_HASH_KEY_STRING);
+      if (keywords_prop)
+        SVN_ERR(svn_subst_build_keywords2(&keywords, keywords_prop->data,
+                                          NULL, NULL, 0, NULL,
+                                          scratch_pool));
+      if (svn_subst_translation_required(eol_style, SVN_SUBST_NATIVE_EOL_STR,
+                                         keywords, FALSE, TRUE))
+        {
+          svn_stream_t *working_content;
+          svn_stream_t *normalized_content;
+
+          SVN_ERR(svn_stream_open_readonly(&working_content, file2_abspath,
+                                           scratch_pool, scratch_pool));
+
+          /* Create a temporary file and copy normalised data into it. */
+          SVN_ERR(svn_stream_open_unique(&file2_content, &file2_abspath, NULL,
+                                         svn_io_file_del_on_pool_cleanup,
+                                         scratch_pool, scratch_pool));
+          normalized_content = svn_subst_stream_translated(
+                                 file2_content, SVN_SUBST_NATIVE_EOL_STR,
+                                 TRUE, keywords, FALSE, scratch_pool);
+          SVN_ERR(svn_stream_copy3(working_content, normalized_content,
+                                   ctx->cancel_func, ctx->cancel_baton,
+                                   scratch_pool));
+        }
+    }
 
   if (kind1 == svn_node_file && !(show_copies_as_adds && is_copy))
     {