Fix octal number literals.
Close files for Protocol objects.
Close files for Pack objects.
Close file objects.
News entry for file object closing.
Merge branch 'python3-close-files' of git://github.com/garyvdm/dulwich
Skip porcelain archive test when c git is not available.
Add write_error argument to GitClient.archive().
Merge branch 'octal-numbers' of git://github.com/garyvdm/dulwich
Skip side-band-64k TCP server tests on windows if cgit not >= 1.9.3.

Signed-off-by: Jelmer Vernooĳ <jelmer@samba.org>
Add .gitattributes files to force fast-export data for tests to checkout with lf line endings.

Signed-off-by: Jelmer Vernooĳ <jelmer@samba.org>
pack: enhance docstring on deltify_pack_objects

Change-Id: If208d523b3d7bb4d83f7ded2fec47d5c1052bbf0
pack.create_delta: move encode_size to not be a nested function

No functional change, just tidies things up a little bit.

Change-Id: I48810dec9788584812dabe36976de60d24fce498
pack.create_delta: rename a couple of variables to make the code clearer

Change-Id: I5fed216800445277d6e069e0b20051006330d405
pack.create_delta: correctly encode copy operations up to 2^24 in size

At present we still produce incorrect results for operations larger
than this size. That defect will be fixed in a follow-up to this
change.

Change-Id: Id63b500ae514caa4339063cde2d6486309a8a056
pack.create_delta: fix copy operations that are larger than 2^24 bytes

This correctly decomposes copies of sequences longer than 2^24 into
smaller copy operations, so that really big blobs in a repository
don't result in corrupt packs.

Note that difflib.SequenceMatcher is worst-case O(n^2) on its input,
so this is very slow. We may want to add an optional parameter to the
packing code that specifies a maximum size to deltify (beyond that
size we'd just include fulltexts in the packfile.)

This will be tested by a follow-up change after we enable
deltification in our pack-building code, as the easiest way to prove
this works correctly involves building a pack and feeding it to
git-verify-pack.

Change-Id: Ic30fa433a2f3b88ddb1aacfe4788dbd47b2e4490
Add tests for encode functions.
pack.write_pack_data: when writing OFS_DELTA entries, write correct offset

The old code wrote the OFS_DELTA offset as the offset from the start
of the pack file, which is
wrong. git.git/Documentation/technical/pack-format.txt states that the
offset is the number of bytes before the current object header that
the base object header starts, which is what we now write.

A future patch will exercise this code by enabling the writing of
deltas during packing.

Change-Id: Ie8431339e4ca3a6cc4e1969b90150b7a6e464d4c
compat/test_pack: extract parsing of git-verify-pack output

A future test will want to reuse this same logic.

Change-Id: Icd36632331a514479cf8a89cdb0932a9eaf57e08
pack.write_pack_objects: when packing, actually build deltas

This results in producing smaller packs. Includes a test that verifies
the resulting pack contains a delta and passes git-verify-pack's
checks.

Change-Id: I63f875cfe412ad727bc1364e3ed0a2b1d7214260