Package: detools
AboutBinarydelta encodingin Python 3.6+ and C.Based onhttp://www.daemonology.net/bsdiff/andHDiffPatch, with
the following features:bsdiff, hdiffpatch and match-blocks algorithms.sequential, hdiffpatch orin-place(resumable) patch types.BZ2, LZ4, LZMA,Zstandard,heatshrinkor CRLE compression.Sequential patches allow streaming.Maximum file size is 2 GB for the bsdiff algorithm. There is
practically no limit for the hdiffpatch and match-blocks algorithms.Incremental apply patchimplemented in C, suitable for memory
constrained embedded devices. Only the sequential patch type is
supported.SA-ISor divsufsort instead of qsufsort for bsdiff.Optional experimental data format aware algorithm for potentially
smaller patches. I don’t recommend anyone to use this functionality
as the gain is small in relation to memory usage and code
complexity!There is a risk this functionality uses patenthttps://patents.google.com/patent/EP1988455B1/en. Anyway, this
patent expires in August 2019 as I understand it.Supported data formats:ARM Cortex-M4AArch64Project homepage:https://github.com/eerimoq/detoolsDocumentation:http://detools.readthedocs.org/en/latestInstallationpipinstalldetoolsStatisticsPatch sizes, memory usage (RSS) and elapsed times when creating a
patch from Python-3.7.3.tar (79M) to Python-3.8.1.tar (84M) for
various algorithm, patch type and compression combinations.Seetests/benchmark.shfor details on how the data was collected.AlgorithmPatch typeCompr.Patch sizeRSSTimebsdiffsequentiallzma3,5M662M0:24.29bsdiffsequentialnone86M646M0:15.20hdiffpatchhdiffpatchlzma2,4M523M0:13.74hdiffpatchhdiffpatchnone7,2M523M0:10.24match-blockssequentiallzma2,9M273M0:08.57match-blockssequentialnone84M273M0:01.72match-blockshdiffpatchlzma2,6M212M0:06.07match-blockshdiffpatchnone9,7M212M0:01.30Same as above, but for MicroPython ESP8266 binary releases (from 604k
to 615k).AlgorithmPatch typeCompr.Patch sizeRSSTimebsdiffsequentiallzma71K46M0:00.64bsdiffsequentialnone609K27M0:00.33hdiffpatchhdiffpatchlzma65K42M0:00.37hdiffpatchhdiffpatchnone123K25M0:00.32match-blockssequentiallzma194K46M0:00.44match-blockssequentialnone606K25M0:00.22match-blockshdiffpatchlzma189K43M0:00.38match-blockshdiffpatchnone313K24M0:00.19Example usageExamples in C are found inc.Command line toolThe create patch subcommandCreate a patchfoo.patchfromtests/files/foo/oldtotests/files/foo/new.$ detools create_patch tests/files/foo/old tests/files/foo/new foo.patch
Successfully created 'foo.patch' in 0.01 seconds!
$ ls -l foo.patch
-rw-rw-r-- 1 erik erik 127 feb  2 10:35 foo.patchCreate the same patch as above, but without compression.$ detools create_patch --compression none \
      tests/files/foo/old tests/files/foo/new foo-no-compression.patch
Successfully created 'foo-no-compression.patch' in 0 seconds!
$ ls -l foo-no-compression.patch
-rw-rw-r-- 1 erik erik 2792 feb  2 10:35 foo-no-compression.patchCreate a hdiffpatch patchfoo-hdiffpatch.patch.$ detools create_patch --algorithm hdiffpatch --patch-type hdiffpatch \
      tests/files/foo/old tests/files/foo/new foo-hdiffpatch.patch
Successfully created patch 'foo-hdiffpatch.patch' in 0.01 seconds!
$ ls -l foo-hdiffpatch.patch
-rw-rw-r-- 1 erik erik 146 feb  2 10:37 foo-hdiffpatch.patchLower memory usage with--algorithmmatch-blocksalgorithm. Mainly
useful for big files. Creates slightly bigger patches thanbsdiffandhdiffpatch.$ detools create_patch --algorithm match-blocks \
      tests/files/foo/old tests/files/foo/new foo-hdiffpatch-64.patch
Successfully created patch 'foo-hdiffpatch-64.patch' in 0.01 seconds!
$ ls -l foo-hdiffpatch-64.patch
-rw-rw-r-- 1 erik erik 404 feb  8 11:03 foo-hdiffpatch-64.patchNon-sequential but smaller patch with--patch-typehdiffpatch.$ detools create_patch \
      --algorithm match-blocks --patch-type hdiffpatch \
      tests/files/foo/old tests/files/foo/new foo-hdiffpatch-sequential.patch
Successfully created 'foo-hdiffpatch-sequential.patch' in 0.01 seconds!
$ ls -l foo-hdiffpatch-sequential.patch
-rw-rw-r-- 1 erik erik 389 feb  8 11:05 foo-hdiffpatch-sequential.patchThe create in-place patch subcommandCreate an in-place patchfoo-in-place.patch.$ detools create_patch_in_place --memory-size 3000 --segment-size 500 \
      tests/files/foo/old tests/files/foo/new foo-in-place.patch
Successfully created 'foo-in-place.patch' in 0.01 seconds!
$ ls -l foo-in-place.patch
-rw-rw-r-- 1 erik erik 672 feb  2 10:36 foo-in-place.patchThe create bsdiff patch subcommandCreate a bsdiff patchfoo-bsdiff.patch, compatible with the
original bsdiff program.$ detools create_patch_bsdiff \
      tests/files/foo/old tests/files/foo/new foo-bsdiff.patch
Successfully created 'foo-bsdiff.patch' in 0 seconds!
$ ls -l foo-bsdiff.patch
-rw-rw-r-- 1 erik erik 261 feb  2 10:36 foo-bsdiff.patchThe apply patch subcommandApply the patchfoo.patchtotests/files/foo/oldto createfoo.new.$ detools apply_patch tests/files/foo/old foo.patch foo.new
Successfully created 'foo.new' in 0 seconds!
$ ls -l foo.new
-rw-rw-r-- 1 erik erik 2780 feb  2 10:38 foo.newThe in-place apply patch subcommandApply the in-place patchfoo-in-place.patchtofoo.mem.$ cp tests/files/foo/in-place-3000-500.mem foo.mem
$ detools apply_patch_in_place foo.mem foo-in-place.patch
Successfully created 'foo.mem' in 0 seconds!
$ ls -l foo.mem
-rw-rw-r-- 1 erik erik 3000 feb  2 10:40 foo.memThe bsdiff apply patch subcommandApply the patchfoo-bsdiff.patchtotests/files/foo/oldto
createfoo.new.$ detools apply_patch_bsdiff tests/files/foo/old foo-bsdiff.patch foo.new
Successfully created 'foo.new' in 0 seconds!
$ ls -l foo.new
-rw-rw-r-- 1 erik erik 2780 feb  2 10:41 foo.newThe patch info subcommandPrint information about the patchfoo.patch.$ detools patch_info foo.patch
Type:               sequential
Patch size:         127 bytes
To size:            2.71 KiB
Patch/to ratio:     4.6 % (lower is better)
Diff/extra ratio:   9828.6 % (higher is better)
Size/data ratio:    0.3 % (lower is better)
Compression:        lzma

Number of diffs:    2
Total diff size:    2.69 KiB
Average diff size:  1.34 KiB
Median diff size:   1.34 KiB

Number of extras:   2
Total extra size:   28 bytes
Average extra size: 14 bytes
Median extra size:  14 bytesContributingFork the repository.Install prerequisites.pip install -r requirements.txtImplement the new feature or bug fix.Implement test case(s) to ensure that future changes do not break
legacy.Run the tests.make testCreate a pull request.