subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r880702 - in /subversion/trunk/subversion: include/private/svn_diff_private.h libsvn_diff/parse-diff.c
Date Mon, 16 Nov 2009 10:38:44 GMT
Author: stsp
Date: Mon Nov 16 10:38:41 2009
New Revision: 880702

URL: http://svn.apache.org/viewvc?rev=880702&view=rev
Log:
Revert r39460, I mean, r879534. The patch code needs verbatim
unidiff text to dump hunks into reject files.

* subversion/include/private/svn_diff_private.h
  (svn_hunk_t): Re-add DIFF_TEXT member.

* subversion/libsvn_diff/parse-diff.c
  (parse_next_hunk): Initialise DIFF_TEXT member again.
  (close_hunk): Close DIFF_TEXT member again.

Modified:
    subversion/trunk/subversion/include/private/svn_diff_private.h
    subversion/trunk/subversion/libsvn_diff/parse-diff.c

Modified: subversion/trunk/subversion/include/private/svn_diff_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_diff_private.h?rev=880702&r1=880701&r2=880702&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_diff_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_diff_private.h Mon Nov 16 10:38:41 2009
@@ -36,6 +36,10 @@
 
 /* A single hunk inside a patch */
 typedef struct svn_hunk_t {
+  /* The hunk's unidiff text as it appeared in the patch file,
+   * without range information. */
+  svn_stream_t *diff_text;
+
   /* The original and modified texts in the hunk range.
    * Derived from the diff text.
    *

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=880702&r1=880701&r2=880702&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Mon Nov 16 10:38:41 2009
@@ -219,6 +219,7 @@
   svn_boolean_t eof, in_hunk, hunk_seen;
   apr_off_t pos, last_line;
   apr_off_t start, end;
+  svn_stream_t *diff_text;
   svn_stream_t *original_text;
   svn_stream_t *modified_text;
   svn_linenum_t original_lines;
@@ -330,6 +331,13 @@
       apr_file_t *f;
       apr_int32_t flags = APR_READ | APR_BUFFERED;
 
+      /* Create a stream which returns the hunk text itself. */
+      SVN_ERR(svn_io_file_open(&f, patch->path, flags, APR_OS_DEFAULT,
+                               result_pool));
+      diff_text = svn_stream_from_aprfile_range_readonly(f, FALSE,
+                                                         start, end,
+                                                         result_pool);
+
       /* Create a stream which returns the original hunk text. */
       SVN_ERR(svn_io_file_open(&f, patch->path, flags, APR_OS_DEFAULT,
                                result_pool));
@@ -350,6 +358,7 @@
       svn_stream_set_line_transformer_callback(modified_text,
                                                remove_leading_char_transformer);
       /* Set the hunk's texts. */
+      (*hunk)->diff_text = diff_text;
       (*hunk)->original_text = original_text;
       (*hunk)->modified_text = modified_text;
     }
@@ -368,6 +377,7 @@
 {
   SVN_ERR(svn_stream_close(hunk->original_text));
   SVN_ERR(svn_stream_close(hunk->modified_text));
+  SVN_ERR(svn_stream_close(hunk->diff_text));
   return SVN_NO_ERROR;
 }
 



Mime
View raw message