[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: #3610, How make 'svn patch' able to use the targets lines for intermediate context?

From: Stefan Sperling <stsp_at_elego.de>
Date: Wed, 14 Apr 2010 17:35:36 +0200

On Wed, Apr 14, 2010 at 04:21:56PM +0200, Daniel Näslund wrote:
> Hi!
>
> #3610 [1] is about ignoring white space changes to be able to apply
> patches that have been mangled, i.e. a mailing software converting tabs
> to spaces, removing trailing white spaces or leading white spaces.
>
> It means that if a certain option is given, we will match and apply
> hunks if the only thing differing is white spaces.

I'd say it means that if a certain option is given, we will match
and apply hunks even if amount of whitespace doesn't match (everything
else must match though).

I.e. we'll add some optional magic in match_hunk(), making it skip over
whitespace on either side (as determined by isspace()), but comparing
any other characters.

> The problem
> -------------
> The '+' lines will be applied with the white spaces changes
> in the patch. That's the intended behaviour. But it would be preferable if
> the context lines would be read from the target. For leading and
> trailing context, I can do that. But in the case when there are context
> lines in the middle of a hunk I can't since svn_hunk_t uses a stream
> called modified_text that makes no distinction between '+' lines and context
> lines, e.g. the leading ' ' or '+' are removed.
>
> The options
> ------------
> 1) Just say that the whole hunk will be applied and we make no
> guarantees on what the white spaces will be.

Yes. Just use whatever comes from the patch, including context lines.
This is consistent with the current behaviour. I think we should avoid
special cases where this rule is currently not true anymore.
(I'm not sure how UNIX patch behaves wrt context lines, actually.
Might be worth checking.)

If people don't like the result of patching, they can edit the patch
to their liking and re-apply it (or ask the submitter to resubmit
the patch -- mangled patches are usually the submitter's fault).

Stefan
Received on 2010-04-14 17:36:09 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.