On Thu, Jan 28, 2010 at 06:10:38PM +0100, Daniel Näslund wrote:
> > > @@ -833,13 +851,17 @@
> > > -copy_hunk_text(svn_stream_t *hunk_text, svn_stream_t *target,
> > > - const char *abspath, apr_pool_t *scratch_pool)
> > > +copy_hunk_lines(svn_stream_t *hunk_text, svn_stream_t *target,
> > > + const char *abspath, int fuzz, int n,
> > > + apr_pool_t *scratch_pool)
> > Looking at the places where copy_hunk_lines() is called, it seems
> > we can simplify the parameter list of this function a lot by passing
> > a hunk_info_t *hi into copy_hunk_lines(). Then we won't need the n
> > and fuzz parameters, and special cases around n and fuzz can be
> > handled within the function.
> > And we could rename the function to copy_hunk() which is even shorter.
> To copy a hunk is ambigous. When the hunk is rejected we want to copy
> the diff_text, when it is accepted we want the modified_text. I'd say,
> leave as is.
But HI->rejected will tell you if the hunk was rejected! :)
And you can pass the entire patch_target_t to give copy_hunk_lines()
access to both the patched and rejected streams.
We could rename it to emit_hunk(), flush_hunk(), hunk_done(), or something
similar, signifying that the function is responsible for dealing with
a hunk which has been processed.
The function itself can figure out what to do with the hunk, based on
information in the hunk_info_t, rather than having the caller figure it out.
Received on 2010-01-28 18:30:19 CET