Part of bzrlib
We separate the implementation from the groupcompress.py to avoid importing useless stuff.
| Class | LinesDeltaIndex | This class indexes matches between strings. |
| Function | encode_base128_int | Convert an integer into a 7-bit lsb encoding. |
| Function | decode_base128_int | Decode an integer from a 7-bit lsb encoding. |
| Function | encode_copy_instruction | Convert this offset into a control code and bytes. |
| Function | decode_copy_instruction | Decode a copy instruction from the next few bytes. |
| Function | make_delta | Create a delta from source to target. |
| Function | apply_delta | Apply delta to this object to become new_version_id. |
| Function | apply_delta_to_source | Extract a delta from source bytes, and apply it. |
| Class | _OutputHandler | A simple class which just tracks how to split up an insert request. |
A copy instruction is a variable number of bytes, so we will parse the bytes we care about, and return the new position, as well as the offset and length referred to in the bytes.
| Parameters | bytes | A string of bytes |
| cmd | The command code | |
| pos | The position in bytes right after the copy command | |
| Returns | (offset, length, newpos) The offset of the copy start, the number of bytes to copy, and the position after the last byte of the copy | |