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

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

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Wed, 14 Apr 2010 16:21:56 +0200

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.

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.

2) Change svn_hunk_t to make it possible to differ between context and
'+' lines. I really hope I don't have to do that since using
modified_text and original_text is a clean solution and all the code in
libsvn_client/patch.c depends on the current representation.

3) Introduce some sort of list of offsets into the hunk for where
intermediate context starts and ends. Yeah, that sucks!

Any suggestions? I'd go with option 1, since the other two are
complicated and ugly to implement.

cheers,
Daniel

[1] http://subversion.tigris.org/issues/show_bug.cgi?id=3610
Received on 2010-04-14 16:22:44 CEST

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