You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dipu Haridasan <di...@juniper.net> on 2020/01/03 23:27:01 UTC

SVN Patch Vs GNU Patch

Hi Team,

I observed that for `svn patch` to apply properly, the spaces between filename and revision in the patch must be a tab. However, the GNU patch works irrespective of the number of spaces between filename and revision. For example, the below patch can be applied using the GNU patch, however with `svn patch` it fails to apply the patch as there are more spaces between filename and revision argument (brcm_cos_utils.c     (revision 1070911)).

Index: brcm_cos_utils.c
===================================================================
--- brcm_cos_utils.c     (revision 1070911)            <<< Extra spaces between filename and revision.
+++ brcm_cos_utils.c   (working copy)
@@ -1216,8 +1216,8 @@

Wondering if this can be considered as a feature request for svn, as GNU (Unix) patch handles it irrespective of the spaces between filenames and revision.

Thanks,
Dipu H


Re: SVN Patch Vs GNU Patch

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Stefan Sperling wrote on Sat, 04 Jan 2020 09:35 +00:00:
> Patch files can be mangled during transfer in any number of ways.
> Adding workarounds for mangled patches is not a sustainable approach.

Perhaps the maintainers of the "patchutils" package would be open to
adding a tool that fixes this sort of problem.  Such a tool could fix the
--- and +++ headers, either heuristically (s/\s\s\s.*//; s/(\t\s|\s\t).*//; etc)
or with reference to files that exist under the cwd.  Then patches could
be piped through that tool before being applied by svn.

Re: SVN Patch Vs GNU Patch

Posted by Stefan Sperling <st...@elego.de>.
On Fri, Jan 03, 2020 at 11:27:01PM +0000, Dipu Haridasan wrote:
> Hi Team,
> 
> I observed that for `svn patch` to apply properly, the spaces between filename and revision in the patch must be a tab. However, the GNU patch works irrespective of the number of spaces between filename and revision. For example, the below patch can be applied using the GNU patch, however with `svn patch` it fails to apply the patch as there are more spaces between filename and revision argument (brcm_cos_utils.c     (revision 1070911)).
> 
> Index: brcm_cos_utils.c
> ===================================================================
> --- brcm_cos_utils.c     (revision 1070911)            <<< Extra spaces between filename and revision.
> +++ brcm_cos_utils.c   (working copy)
> @@ -1216,8 +1216,8 @@
> 
> Wondering if this can be considered as a feature request for svn, as GNU (Unix) patch handles it irrespective of the spaces between filenames and revision.
> 
> Thanks,
> Dipu H
> 

This was discussed just a few days ago on the dev@ list:
https://svn.haxx.se/dev/archive-2019-12/0108.shtml

'svn patch' works with the output of regular diff tools, 'svn diff', and the
diff output produced by other version control systems such as git and hg.
If a patch does not apply after transfer that means it was broken in transit.

Patch files can be mangled during transfer in any number of ways.
Adding workarounds for mangled patches is not a sustainable approach.