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

Re: svn commit: r40403 - trunk/subversion/libsvn_diff

From: Daniel Rall <dlr_at_finemaltcoding.com>
Date: Fri, 6 Nov 2009 09:47:12 -0800

On Fri, Nov 6, 2009 at 9:38 AM, Branko Čibej <brane_at_xbc.nu> wrote:
> Daniel Rall wrote:
>> On Fri, Nov 6, 2009 at 9:31 AM, Arfrever Frehtes Taifersar Arahesis
>> <Arfrever.FTA_at_gmail.com> wrote:
>>
>>> 2009-11-06 16:37:10 Stefan Sperling napisał(a):
>>>
>> ...
>>
>>>> @@ -248,6 +252,11 @@ parse_next_hunk(svn_hunk_t **hunk,
>>>>        last_line = pos;
>>>>        SVN_ERR(svn_stream_readline(stream, &line, patch->eol_str, &eof,
>>>>                                    iterpool));
>>>> +
>>>> +      /* Skip lines which aren't part of the hunk text. */
>>>> +      if (strcmp(line->data, "\\ No newline at end of file") == 0)
>>>> +        continue;
>>>>
>>> Such comparisons won't help for non-English users:
>>>
>>> $ echo -e "x\ny" > file1
>>> $ echo -en "x\ny" > file2
>>> $ diff -u file1 file2
>>> --- file1       2009-11-06 18:19:48.000000000 +0100
>>> +++ file2       2009-11-06 18:19:54.000000000 +0100
>>> @@ -1,2 +1,2 @@
>>>  x
>>> -y
>>> +y
>>> \ Brak znaku nowej linii na końcu pliku
>>> $
>>>
>>
>> Not commenting on the approach, but you could wrap that English string
>> in _() to localize it before the strcmp (maybe still also falling back
>> to the English translation).
>>
>
> In a patch file, a backslash in the first column means "no newline at
> end of file" -- the rest of the line is pure comment and *should* be
> igmored, but that backslash tells you important things about the hunk's
> context.

So, any line starting with a backslash after a hunk should be
discarded, but it must also modify the last line in the hunk, removing
the explicit newline that was part of the patch.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2415168
Received on 2009-11-06 18:47:27 CET

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.