[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 21:41:25 +0200

On Wed, Apr 14, 2010 at 05:49:51PM +0200, Daniel Näslund wrote:
> On Wed, Apr 14, 2010 at 05:35:36PM +0200, Stefan Sperling wrote:
> > 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.
>
> Note that a whitespace may be tabs beeing translated to spaces, e.g.
> it's not enough to just look at the trailing or leading whitespaces.

Yes. I meant either side as in "original and modified text", not as
in "start and end" :) I could have phrased this better.

> I've used this approach (comparing the the lines with all whitespaces
> removed):
> [[[
> if (ignore_whitespaces)
> {
> char *stripped_hunk_line = apr_pstrdup(pool,
> hunk_line_translated);
> char *stripped_target_line = apr_pstrdup(pool, target_line);
>
> apr_collapse_spaces(stripped_hunk_line,
> hunk_line_translated);
> apr_collapse_spaces(stripped_target_line, target_line);
> lines_matched = ! strcmp(stripped_hunk_line,
> stripped_target_line);
> }
> ]]]

Looks fine.

Stefan
Received on 2010-04-14 21:59:23 CEST

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