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

Re: Bulit-in patch is needed when --patch-cmd option of 'svn patch' is omitted

From: masaru tsuchiyama <m.tmatma_at_gmail.com>
Date: Mon, 22 Sep 2008 08:55:23 +0900

Hi.

Thanks for the reply.

I get GNU patch from http://gnuwin32.sourceforge.net/packages/patch.htm
and run "svn patch --patch-cmd=patch.exe out.txt".

But I get the following error.
   patching file build.conf
   patching file www/hacking.html
   Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

   This application has requested the Runtime to terminate it in an unusual way.
   Please contact the application's support team for more information.
   svn: 'patch.exe' returned error exitcode 3

I open the patch file with a text editor and find that the file has
CRs and CR-LFs.
Then I convert the line endings to CR-LF and re-try 'svn patch'. I can
successfully
apply the patch.

It seems GNU patch can't handle mixed line endings and 'svn diff --svnpatch'
produces a mixed-line-ending result on Windows.

Regards.
Masaru.

2008/9/22 Arfrever Frehtes Taifersar Arahesis <arfrever.fta_at_gmail.com>:
> 2008-09-21 04:11:27 masaru tsuchiyama napisaƂ(a):
>> Hi.
>>
>> I tried svnpatch-diff branch on Windows XP.
>>
>> I got the followging error when patching.
>> ---------------------------------------------------------------------
>> D:\...>svn patch out.txt
>> patching file build.conf
>> patching file www/hacking.html
>> Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
>>
>> This application has requested the Runtime to terminate it in an unusual way.
>> Please contact the application's support team for more information.
>> svn: No 'patch' program was found in your system. Please try
>> to use --patch-cmd or 'patch-cmd' run-time configuration
>> option or manually use an external tool to apply Unidiffs.
>> svn: External program is missing
>> ---------------------------------------------------------------------
>>
>> patch program is usaually not available on Windows.
>> 'svn diff' command also has '--diff-cmd' option, but it uses built-in
>> diff if the option is omitted.
>>
>> I think 'svn patch' also should use built-in patch if '--patch-cmd'
>> option is omitted.
>
> Built-in patch isn't implemented. You need to install GNU patch.
> If %PATH% variable contains the directory with the 'patch' executable, you
> won't need to use '--patch-cmd' option.
>
> ^/branches/svnpatch-diff/notes/svnpatch contains this fragment:
>
> V PATCHING
> --------
>
> When it comes to applying an svnpatch patch (RAS syndrom), the 'svn patch'
> subcommand is a good friend. We don't currently support applying (a) Unidiffs
> internally. We instead call an external program to do the job for us which the
> user may specify with the 'patch-cmd' entry in the run-time configuration. 'svn
> patch' also has a --patch-cmd flag that overrides this run-time config. When
> none of those flags are specified, the ultimate fallback is to try to call
> 'patch'. Since GNU patch is widely available on many UNIX-like platforms, this
> workaround should cover a fairly large amount of users. No decision nor
> consensus have been taken towards this issue yet.
> On the other hand, (b) is handled with internal routines that read and drive
> editor functions out from the patch file much like what's being performed by
> libsvn_ra_svn with a network stream.
>
> Put differently, for now 'svn patch' will gladly apply any (full-featured-)patch
> on GNU-patch-enabled environments while it will bail out with a message on a
> GNU-patch-less one. In the latter, the user is left the burden to apply the
> Unidiff with his own tools.
>
> --
> Arfrever Frehtes Taifersar Arahesis
>
Received on 2008-09-22 01:55:44 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.