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:
-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
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.
> 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!
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.
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.
Re: Create/Apply Patch - UTF-16 and binary support
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
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