How to convert an rdiff delta file to a regular diff?
I need to diff two very large files, far too large for diff
to handle. rdiff
can produce a delta file for them in a few seconds, but I'd like to have a real diff as output. Is there an existing way of converting an rdiff
delta to a regular diff?
Solution 1:
I don't think this is (easily) possible. rdiff
parses the files as chunks of bytes, generating a signature for fixed-size blocks of bytes. The new file is then compared to those signatures. The delta file contains all different blocks, which do not necessarily match lines in the original or compared file.
For instance, an original:
AAAAAAAAAA
BBBBBBBBBB
CCCCCCCCCC
DDDDDDDDDD
compared with:
AAAAAAAAAA
BBBBOOOBBB
CCCCCCCCCC
DDDDDDDDDD
could produce a delta:
[..]BOOOBBB
CCCCCCCCCCC
DDDDDDD[..]
Regular diff
files usually contain all changed lines. The rdiff
delta file will probably only a part of some changed lines, and a lot of unchanged lines as well. You would have to parse the file(s) again to determine the actual changed lines.
For more information, see the rdiff
documentation or http://librsync.sourcefrog.net/doc/rdiff.html