Subject: [PATCH/RFC 0/11] Building up the delta parser

From: Jonathan Nieder <[email-masked]>
Date: Wed, 13 Oct 2010 04:17:14 -0500

Jonathan Nieder wrote:

> Implement an svndiff 0 interpreter

I hear that was nigh unreadable, so here's a reroll.  Less
cargo-cult support for broken deltas, more readability and tests.
Patches apply on top of "[PATCH 15/16] t9010 (svn-fe): Eliminate
dependency on svn perl bindings".  As before, the end result
includes a 'test-svn-fe -d' command that can apply svndiff0-format
deltas, meaning less binary garbage to worry about as you puzzle
over that confusing "svnrdump dump" output in debugging sessions.

Questions?  Improvements?  Bugs?

Patch 1 is a fixup to the variable-length integer parsing code, to
report unexpected EOF (i.e., declared content length too long)
correctly when it occurs in the middle of such an integer.

Patch 2 is the svndiff0 interpreter in broad strokes: read window,
read window, read window, ....  The patch doesn't encode any
knowledge about what actually goes _in_ a window aside from the
header, so it will error out for nonempty windows.

Patch 3 teaches the nacent interpreter to keep the appropriate
piece of the preimage in memory.  This is probably earlier in the
series than it ought to be, but I wanted to try out the sliding
window code.

With patches 4 and 5, the interpreter learns to read the "data"
and "instructions" section of a window.  The effect is observable
because it finds the beginning of the next window correctly.

Patch 6 is an example instruction (copyfrom_data).

Patches 7-8 introduce some sanity checks.

Patches 9 and 10 are another instruction (copyfrom_target) and
another sanity check.

Patch 11 is the last instruction (copyfrom_source).  That's it.
You can apply deltas now!

If anything seems unclear, please don't spend time puzzling it
out --- just yell at me, so the code or documentation can be
cleaned up.  Happy reading.