[darcs-devel] Re: Idea: a new type of patch

Benedikt Schmidt ry102 at rz.uni-karlsruhe.de
Sat Apr 30 14:42:43 PDT 2005


David Roundy <droundy at abridgegame.org> writes:

> On Fri, Apr 29, 2005 at 11:43:32PM +0100, Ian Lynagh wrote:
>> On Fri, Apr 29, 2005 at 06:18:28PM +0200, Juliusz Chroboczek wrote:
>> >   Hunk <filname> <line> <n1> <n2>
>> >   <n1 bytes of data><n2 bytes of data>
>> 
>> We also needs numbers of lines so we can commute it when possible
>> without having to count newlines.
>
> I'm thinking that we could have alternative on-disk representations of the
> same patch--where users would have to explicitly request the new format, so
> we'd have backward interoperability.
>
> As far as the new hunk format goes, I think I'd lean towards something more
> like
>
> hunk-block <filname> <line> <lines1> <n1> <lines2> <n2>
> old:
> <n1 bytes of data>\n
> new:
> <n2 bytes of data>\n
>
> which would be moderately more human-readable, and just as fast to parse.

If we redesign the on-disk representation, i think a more efficient binary
representation should be included too. And support for xdelta binary patches
or something comparable. If we allow binary blobs inside of the patch files
something like the above without the line numbers can be used for binary
files/patches too. If not, we can just store a hash of the binary blob and
place it in a separate file or just use git for that.

binary-blob <filname> <offset> <n1> <n2>
old:
<n1 bytes of data>\n
new:
<n2 bytes of data>\n

and

xdelta <filename> <n1> <n2>
old:
<n1 bytes of xdelta new->old>\n
new:
<n2 bytes of xdelta old->new>\n

or instead of the data just the address of the blob/xdelta in the git db.

Benedikt





More information about the darcs-devel mailing list