Create/Apply Patch - UTF-16 and binary support

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Create/Apply Patch - UTF-16 and binary support

Friedrich.Brunzema

Hi,

 

I’m requesting that someone fix the Create/Apply patch functionality of Subversion.  Having spoken to Stefan Küng of TortoiseSVN fame, he mentioned that there are a few problems with the create /apply patch that need fixing on the Subversion side before we can do anything on the TortoiseSVN side.  Two specific things come to mind:

 

-UTF-16 support.

-Binary format file.

 

The use case is as follows:

I have some uncommitted changes in my working copy – an added .png binary file, and a modified UTF-16 encoded windows resource-script file (.rc).  I want to send changes to a friend for review before committing them to the repo.  My friend should just receive the .patch file and be able to apply the patch to get to the same Working copy as is on my system.  Right now, I have to think about binary and UTF-16 encoded files, and put those in a zip file.

 

Stefan told me that someone had implemented such functionality in the past - that it did not end up getting used because the diff clients needed changing.

 

I’m kind of surprised/disappointed that a reliable patch mechanism does not seem to exist for svn.  When I do a commit, the changes are bunched up in some binary format and sent to the server.  Can we not capture this kind of data in some text-encoded format, and have the patch program understand the format?

 

Below are some archived posts about Create/Apply Patch

http://svn.haxx.se/tsvnusers/archive-2011-05/0012.shtml

http://svn.haxx.se/tsvn/archive-2009-04/0197.shtml

 

Best regards,

 

Friedrich Brunzema

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Create/Apply Patch - UTF-16 and binary support

Stefan Sperling
On Wed, May 22, 2013 at 12:29:16PM -0400, Friedrich.Brunzema wrote:
> I’m kind of surprised/disappointed that a reliable patch mechanism does not
> seem to exist for svn.

Well, before Subversion 1.7, there was no support for applying patches at all!

I think the basic problem you're asking about is that Subversion
does not support UTF-16 as a text format. This problem isn't specific
to the 'svn patch' command. Solving this problem probably isn't trivial.
See http://subversion.tigris.org/issues/show_bug.cgi?id=2194
Reply | Threaded
Open this post in threaded view
|

Re: Create/Apply Patch - UTF-16 and binary support

Branko Čibej-5
In reply to this post by Friedrich.Brunzema
On 22.05.2013 18:29, Friedrich.Brunzema wrote:
> When I do a commit, the changes are bunched up in some binary format
> and sent to the server.  Can we not capture this kind of data in some
> text-encoded format, and have the patch program understand the format?

A binary delta will apply correctly only to exactly the same, unmodified
source. A patch, on the other hand, contans context information that
help it find parts of the file that (appear to) match whatever source
the patch was created from.

See:
    http://en.wikipedia.org/wiki/Delta_encoding
vs.
    http://en.wikipedia.org/wiki/Diff

-- Brane


--
Branko Čibej
Director of Subversion | WANdisco | www.wandisco.com

Reply | Threaded
Open this post in threaded view
|

Re: Create/Apply Patch - UTF-16 and binary support

Julian Foad
In reply to this post by Stefan Sperling
Stefan Sperling wrote:

> On Wed, May 22, 2013 at 12:29:16PM -0400, Friedrich.Brunzema wrote:
>>  I’m kind of surprised/disappointed that a reliable patch mechanism does not
>>  seem to exist for svn.
>
> Well, before Subversion 1.7, there was no support for applying patches at all!

There was in TortoiseSVN.

> I think the basic problem you're asking about is that Subversion
> does not support UTF-16 as a text format. This problem isn't specific
> to the 'svn patch' command. Solving this problem probably isn't
> trivial.
> See http://subversion.tigris.org/issues/show_bug.cgi?id=2194

That is one of the two problems that Friedrich listed.  The other is that Svn does not support patching of 'binary' files.  (More generally, Subversion cannot round-trip an arbitrary change from 'svn diff' to 'svn patch' and back.  As well as no support for 'binary' files, it has only partial support for tree changes.)

There is some overlap between those two issues, but neither of them strictly depends on the other.

Friedrich, I also wish we could support these two requirements.  As an open source project, development happens mainly when somebody steps up and does it.  Are you, or is anybody you know, able to help specify or design or implement these features?  Even starting to discuss how it could work can sometimes be enough to get other people involved.  I personally would be willing to help with supporting a more complete diff and patch, since I am currently working in the area of diff and merge and renames.

- Julian
Reply | Threaded
Open this post in threaded view
|

Re: Create/Apply Patch - UTF-16 and binary support

Mark Phippard-3
In reply to this post by Friedrich.Brunzema
On Wed, May 22, 2013 at 12:29 PM, Friedrich.Brunzema <[hidden email]> wrote:

> Stefan told me that someone had implemented such functionality in the past -
> that it did not end up getting used because the diff clients needed
> changing.

I thin Stefan was talking about this Summer of Code project:

http://svn.haxx.se/dev/archive-2007-03/0399.shtml

It was in fact implemented and never released.  My recollection was
that a big problem was the one that Branko mentioned, that binary
deltas cannot simply be applied to any revision.  So you could only
apply these patches to working copies that were the same or similar
revision as the one that created the patch.  And of course they also
could not have been applied with a generic patch program either.

One would need to reach through the archives for the summer and fall
of 2007 to find all the details.

--
Thanks

Mark Phippard
http://markphip.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Create/Apply Patch - UTF-16 and binary support

Friedrich.Brunzema
In reply to this post by Stefan Sperling
Stefan S,

yes, lack of UTF-16 is one of the issues.  The other is creating / applying patches for binary files.

By the sounds of it, this is not really a burning issue for the project - ie not on your roadmap.
Question is - how useful would this functionality be to end-users?  Maybe using a .zip program to ship changes
to a fellow developer is just as easy - are these non-trival svn changes worth the effort is what I'm asking, I guess.
Still, conceptually I'm kind of bothered by the fact that svn has the functionality, but that it does not work reliably for all file types.
If it does not work reliably, is it even worth having the create patch/apply patch functionality? [Just putting the question out there...]

Stefan K- One could try to tackle this problem on the TortoiseSVN side.  Have a new Create Zip patch - functionality looks for changed wc files,
zips all of them using the correct hierarchy from the working copy.  Patch could just overwrite in a dumb way, or could actually try to merge
what it can.  Or you don't provide a patch function at all, but leave unzipping to the end-user.  Still, this sounds like a bad hack.

If one were to try tackling this problem and fixing it the 'right way' (and I'm not saying I necessarily would), where would one start?

Grüße,

Friedrich Brunzema


From: Stefan Sperling <[hidden email]>
To: Friedrich.Brunzema <[hidden email]>
Cc: [hidden email]; [hidden email]
Sent: Wednesday, May 22, 2013 1:50:45 PM
Subject: Re: Create/Apply Patch - UTF-16 and binary support

On Wed, May 22, 2013 at 12:29:16PM -0400, Friedrich.Brunzema wrote:
> I’m kind of surprised/disappointed that a reliable patch mechanism does not
> seem to exist for svn.

Well, before Subversion 1.7, there was no support for applying patches at all!

I think the basic problem you're asking about is that Subversion
does not support UTF-16 as a text format. This problem isn't specific
to the 'svn patch' command. Solving this problem probably isn't trivial.
See http://subversion.tigris.org/issues/show_bug.cgi?id=2194


Reply | Threaded
Open this post in threaded view
|

Re: Create/Apply Patch - UTF-16 and binary support

Stefan Sperling
On Wed, May 22, 2013 at 01:12:00PM -0700, Friedrich Brunzema wrote:
> By the sounds of it, this is not really a burning issue for the
> project - ie not on your roadmap.

That seems to be the case, yes. You never know who is working on
what in an open source project. But there is no evidence of any
development activity related to this. As Julian pointed out, you
could help make it happen!

> If it does not work reliably, is it even worth having the create
> patch/apply patch functionality? [Just putting the question out
> there...]

Well, 'svn patch' is intended as the Subversion equivalent of the
UNIX patch program: http://en.wikipedia.org/wiki/Patch_%28Unix%29
That program cannot handle binary files either. Therefor, such
functionality was never within the scope of 'svn patch'.

The intended use case is easier handling of patch submissions made to
open source projects which use Subversion (such as FreeBSD). Patches
submitted to such projects rarely contain binary files.
I believe 'svn patch' has fulfilled that purpose very well, so I wouldn't
consider it incomplete at all. Your desired feature simply wasn't part
of the goal of the 'svn patch' development effort (there were earlier
'svn patch' development efforts some years ago, which tried to cover
your use case, too, but they weren't completed).

TortoiseSVN 1.6 did include a custom 'patch' feature, but that was
even more limited than the Subversion 1.7 patch feature is now.
Since TortoiseSVN 1.7, TortoiseSVN's patch feature uses the same
code under the hood that 'svn patch' is using, so it provides the
same functionality.