On Thu, Jan 28, 2010 at 01:55:08PM +0100, Daniel Näslund wrote:
> Index: subversion/libsvn_diff/parse-diff.c
Can't read the whole diff right now, just a couple of small remarks:
> svn_boolean_t lines_matched;
> @@ -630,9 +635,21 @@
> eol_str, FALSE,
> target->keywords, FALSE,
> + lines_read++;
You're adding 2 empty lines here on purpose?
> @@ -659,6 +676,7 @@
> /* Scan lines of TARGET for a match of the original text of HUNK,
> * up to but not including the specified UPPER_LINE.
> + * Use fuzz factor FUZZ everywhere if possible.
s/FUZZ everywhere if possible./FUZZ./
> * If UPPER_LINE is zero scan until EOF occurs when reading from TARGET.
> * Return the line at which HUNK was matched in *MATCHED_LINE.
> * If the hunk did not match at all, set *MATCHED_LINE to zero.
> @@ -833,13 +853,17 @@
> /* Copy HUNK_TEXT into TARGET, line by line, such that the line filter
> * and transformation callbacks set on HUNK_TEXT by the diff parsing
> * code in libsvn_diff will trigger. ABSPATH is the absolute path to the
> - * file underlying TARGET. */
> + * file underlying TARGET. Do not copy the lines that is within FUZZ offset
> + * from the beginning or end of hunk unless NR_OF_LINES is set to 0. If
> + * NR_OF_LINES is non-zero, it represents the number of lines in HUNK_TEXT. */
Maybe rename the function to copy_hunk_lines and call 'nr_of_lines'
> static svn_error_t *
> copy_hunk_text(svn_stream_t *hunk_text, svn_stream_t *target,
> - const char *abspath, apr_pool_t *scratch_pool)
> + const char *abspath, int fuzz, int nr_of_lines,
> + apr_pool_t *scratch_pool)
> svn_boolean_t eof;
> apr_pool_t *iterpool;
> + int read_lines = 0;
> iterpool = svn_pool_create(scratch_pool);
> @@ -895,15 +936,20 @@
> return SVN_NO_ERROR;
> -/* Apply a hunk described by hunk info HI to a patch TARGET.
> +/* Apply a hunk described by hunk info HI to a patch TARGET. If we have FUZZ
> + * use the lines from the target for those lines instead of the hunk lines.
> * Do all allocations in POOL. */
> static svn_error_t *
> -apply_one_hunk(patch_target_t *target, hunk_info_t *hi, apr_pool_t *pool)
> +apply_one_hunk(patch_target_t *target, hunk_info_t *hi,
> + apr_pool_t *pool)
> + svn_linenum_t end_line_nr;
Call it last_line ?
Received on 2010-01-28 13:47:35 CET