commit - 02d2864087f620a5e22ed8bd8031f148ab76ac95
commit + 3317eef581645bbf16aef5b22ea4c3bc3c962666
blob - 065cfd9351a11d5ea8c98c829cbe9ca7489e93c3
blob + 7e2bbe455a6e393c96e114c1da21a1ff3cff49a7
--- dulwich/client.py
+++ dulwich/client.py
assert target is not None
if origin is not None:
target_config = target.get_config()
- target_config.set((b"remote", origin.encode("utf-8")), b"url", encoded_path)
+ target_config.set(
+ (b"remote", origin.encode("utf-8")), b"url", encoded_path
+ )
target_config.set(
(b"remote", origin.encode("utf-8")),
b"fetch",
ref_message = b"clone: from " + encoded_path
result = self.fetch(path, target, progress=progress, depth=depth)
if origin is not None:
- _import_remote_refs(target.refs, origin, result.refs, message=ref_message)
+ _import_remote_refs(
+ target.refs, origin, result.refs, message=ref_message
+ )
origin_head = result.symrefs.get(b"HEAD")
origin_sha = result.refs.get(b"HEAD")
def _wrap_urllib3_exceptions(func):
-
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
blob - 19f35ce31de8b5488a569b9f742b26e7434e67d1
blob + bfd61c591780165593f2edf9bdf16b1ea8cb970b
--- dulwich/config.py
+++ dulwich/config.py
raise NotImplementedError(self.get_multivar)
@overload
- def get_boolean(self, section: SectionLike, name: NameLike, default: bool) -> bool:
- ...
+ def get_boolean(
+ self, section: SectionLike, name: NameLike, default: bool
+ ) -> bool: ...
@overload
- def get_boolean(self, section: SectionLike, name: NameLike) -> Optional[bool]:
- ...
+ def get_boolean(self, section: SectionLike, name: NameLike) -> Optional[bool]: ...
def get_boolean(
self, section: SectionLike, name: NameLike, default: Optional[bool] = None
blob - 6b44eea3e32abc09e79ec6e38b048b56a3218052
blob + 803c009ea27a05df4312c14f3a221191b55dfa56
--- dulwich/contrib/diffstat.py
+++ dulwich/contrib/diffstat.py
def _parse_patch(
- lines: List[bytes]
+ lines: List[bytes],
) -> Tuple[List[bytes], List[bool], List[Tuple[int, int]]]:
"""Parse a git style diff or patch to generate diff stats.
blob - 89012677c04fb8e77b6f4df88d1ed21515aa0994
blob + b556f31485d4e7c173f7d6eae3d0467f7a36f3de
--- dulwich/contrib/requests_vendor.py
+++ dulwich/contrib/requests_vendor.py
This implementation is experimental and does not have any tests.
"""
+
from io import BytesIO
from requests import Session
blob - 960f812e17d8d57445618227f6d5e11bc9b57a84
blob + 05de0452d8ada4329d080fbc4226f6ec4bcaecde
--- dulwich/credentials.py
+++ dulwich/credentials.py
https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage
"""
+
import sys
from typing import Iterator, Optional
from urllib.parse import ParseResult, urlparse
blob - 841d45552cad56a433c0d5833d42ee19008abe1f
blob + 3300b7457449a7a85f0305e5249f7f8d7275d632
--- dulwich/errors.py
+++ dulwich/errors.py
# Please do not add more errors here, but instead add them close to the code
# that raises the error.
-
import binascii
blob - f7b9adbc78f05c2f002b105c6f545e0a9ba3b567
blob + 5345acc2f6beeb4a894b26804f09e7400b5140b6
--- dulwich/index.py
+++ dulwich/index.py
del self._byname[name]
def iteritems(
- self
+ self,
) -> Iterator[Tuple[bytes, Union[IndexEntry, ConflictedIndexEntry]]]:
return iter(self._byname.items())
blob - a241646d06629b3ebb3cf45ecc9b2bb5b536c865
blob + 9fe5fbd7ca157153e73471ec3a604cc0742f0e89
--- dulwich/objects.py
+++ dulwich/objects.py
def _parse_message(
- chunks: Iterable[bytes]
+ chunks: Iterable[bytes],
) -> Iterator[Union[Tuple[None, None], Tuple[Optional[bytes], bytes]]]:
"""Parse a message with a list of fields and a body.
blob - 7578a908aa0cc00b227faa7fb43eea5c35910df0
blob + 6b1af87373ebe2265533ac2bfbbc9de6b8975847
--- dulwich/pack.py
+++ dulwich/pack.py
def sort_objects_for_delta(
- objects: Union[Iterator[ShaFile], Iterator[Tuple[ShaFile, Optional[PackHint]]]]
+ objects: Union[Iterator[ShaFile], Iterator[Tuple[ShaFile, Optional[PackHint]]]],
) -> Iterator[ShaFile]:
magic = []
for entry in objects:
try:
from dulwich._pack import ( # type: ignore
apply_delta, # type: ignore
- bisect_find_sha, # type: ignore
+ bisect_find_sha, # type: ignore
)
except ImportError:
pass
blob - 42ddcfe02a9c1455fbb6d1746d102cee9ea91854
blob + b3d324b23718935755e98ab218ee26bfb9ac2822
--- dulwich/refs.py
+++ dulwich/refs.py
"""Ref handling."""
+
import os
import warnings
from contextlib import suppress
blob - 51624253a8b8bf8740c1a4cf15fb8b962c3039a3
blob + 0b577241a71b546af58bfe6300992b647bd24f8c
--- dulwich/stash.py
+++ dulwich/stash.py
"""Stash handling."""
-
import os
from .file import GitFile
blob - 993603a9583017fdc8a19b8969b65c64a4349db1
blob + 351351a5daff60b1370ab5c8b752c15a7560e13c
--- dulwich/tests/compat/test_pack.py
+++ dulwich/tests/compat/test_pack.py
"""Compatibility tests for git packs."""
-
import binascii
import os
import re
blob - 08c10e249fae375fce7c8905ecdd14c8c2c5cedd
blob + aa33f0db73c32d34c612199b7b85a846afe9f804
--- dulwich/tests/compat/test_patch.py
+++ dulwich/tests/compat/test_patch.py
#
"""Tests related to patch compatibility with CGit."""
+
import os
import shutil
import tempfile
blob - 4904a33d301b7f74fb5f4a300675e5b0b51ea904
blob + 3ab51a67ec7be9b6796862f5353c6fb9ef7d183b
--- dulwich/tests/compat/test_repository.py
+++ dulwich/tests/compat/test_repository.py
"""Compatibility tests for dulwich repositories."""
-
import os
import tempfile
from io import BytesIO
blob - 9af8b8822fa7f9babd765ae7e8fbca145f7c4641
blob + 72eebc3e38ee8e04b0244d8a6a960d1a463ca061
--- dulwich/tests/test_client.py
+++ dulwich/tests/test_client.py
)
def test_alternative_command_path_spaces(self):
- self.client.alternative_paths[
- b"upload-pack"
- ] = b"/usr/lib/git/git-upload-pack -ibla"
+ self.client.alternative_paths[b"upload-pack"] = (
+ b"/usr/lib/git/git-upload-pack -ibla"
+ )
self.assertEqual(
b"/usr/lib/git/git-upload-pack -ibla",
self.client._get_cmd_path(b"upload-pack"),
blob - b9a72b5dbaa40dc9f92cff3a3bde3282260d8de1
blob + 28c041dc32a47d237ab85f5419a85376ff4e8102
--- dulwich/tests/test_index.py
+++ dulwich/tests/test_index.py
"""Tests for the index."""
-
import os
import shutil
import stat
blob - 0dc9bea66147f5b6cd3e5a7041d19069a08a1330
blob + fc026082fa4e723ecf8556b4441fc8e45cc3597f
--- dulwich/tests/test_object_store.py
+++ dulwich/tests/test_object_store.py
"""Tests for the object store interface."""
-
import os
import shutil
import stat
blob - 9ea60ee965c4ced9292f70fac7edd9a0e193f569
blob + 8b8b5b5e6e6daaba5eb32206f70b5a1978a2c6ce
--- dulwich/tests/test_objects.py
+++ dulwich/tests/test_objects.py
# TODO: Round-trip parse-serialize-parse and serialize-parse-serialize tests.
-
import datetime
import os
import stat
blob - 10015c4ecff99fe88734db60b27417f87f809f6a
blob + 0e3476e557bbff68354ddb77cb071d540bd9c559
--- dulwich/tests/test_objectspec.py
+++ dulwich/tests/test_objectspec.py
# TODO: Round-trip parse-serialize-parse and serialize-parse-serialize tests.
-
from dulwich.tests import TestCase
from ..objects import Blob
blob - 2c211c2b68449de40c1448785dedaa674d62fb0a
blob + d8fa4c1e33e05a332ce31bb5372fd8a10fa317e8
--- dulwich/tests/test_pack.py
+++ dulwich/tests/test_pack.py
"""Tests for Dulwich packs."""
-
import os
import shutil
import sys
blob - e203919375be0f59889b7a4cf567fe7769a88283
blob + 3d12d18352fea00c16b71b733b92feb93a301f81
--- dulwich/tests/test_protocol.py
+++ dulwich/tests/test_protocol.py
"""Tests for the smart protocol utility functions."""
-
from io import BytesIO
from dulwich.tests import TestCase
blob - ec3d0904b937590e547f14feecaa61ce2b827af5
blob + 21f6bb87ffa1e12e15d1bcc84aeeec288398a8ee
--- dulwich/tests/test_refs.py
+++ dulwich/tests/test_refs.py
self.assertNotIn(b"refs/tags/refs-0.2", self._refs)
def test_import_refs_name(self):
- self._refs[
- b"refs/remotes/origin/other"
- ] = b"48d01bd4b77fed026b154d16493e5deab78f02ec"
+ self._refs[b"refs/remotes/origin/other"] = (
+ b"48d01bd4b77fed026b154d16493e5deab78f02ec"
+ )
self._refs.import_refs(
b"refs/remotes/origin",
{b"master": b"42d06bd4b77fed026b154d16493e5deab78f02ec"},
)
def test_import_refs_name_prune(self):
- self._refs[
- b"refs/remotes/origin/other"
- ] = b"48d01bd4b77fed026b154d16493e5deab78f02ec"
+ self._refs[b"refs/remotes/origin/other"] = (
+ b"48d01bd4b77fed026b154d16493e5deab78f02ec"
+ )
self._refs.import_refs(
b"refs/remotes/origin",
{b"master": b"42d06bd4b77fed026b154d16493e5deab78f02ec"},
blob - cdd235beaa8ffbfe87f4312ecd15e508341b11be
blob + 22f5286456b0eba56dffc49c24c0103353fa1562
--- dulwich/tests/utils.py
+++ dulwich/tests/utils.py
"""Utility functions common to Dulwich tests."""
-
import datetime
import os
import shutil
blob - c0db19e401531d2cfbda7f60c89e66456dea1e2b
blob + 93bd5bbb7e79ed1c48dc6d74e638ed0c345a5c65
--- dulwich/walk.py
+++ dulwich/walk.py
"""General implementation of walking commits and their contents."""
-
import collections
import heapq
from itertools import chain
blob - cafde9e9ca23fbad1aef7429723f1d6c721f66cf
blob + 33e8531ff05a63d80343e6ebefafcdf302a39c52
--- examples/clone.py
+++ examples/clone.py
3. python examples/clone.py git://github.com/jelmer/dulwich.git dulwich
"""
-
import sys
from getopt import getopt
from os.path import basename
blob - d719c6e3ab8a7f3d93a32ac6ecadb76d10791902
blob + 7d1362aebed9018e2d63c3cc397a557d15d77ead
--- setup.py
+++ setup.py
optional = os.environ.get("CIBUILDWHEEL", "0") != "1"
rust_extensions = [
- RustExtension("dulwich._objects", "crates/objects/Cargo.toml", binding=Binding.PyO3, optional=optional),
- RustExtension("dulwich._pack", "crates/pack/Cargo.toml", binding=Binding.PyO3, optional=optional),
- RustExtension("dulwich._diff_tree", "crates/diff-tree/Cargo.toml", binding=Binding.PyO3, optional=optional),
+ RustExtension(
+ "dulwich._objects",
+ "crates/objects/Cargo.toml",
+ binding=Binding.PyO3,
+ optional=optional,
+ ),
+ RustExtension(
+ "dulwich._pack",
+ "crates/pack/Cargo.toml",
+ binding=Binding.PyO3,
+ optional=optional,
+ ),
+ RustExtension(
+ "dulwich._diff_tree",
+ "crates/diff-tree/Cargo.toml",
+ binding=Binding.PyO3,
+ optional=optional,
+ ),
]
# Ideally, setuptools would just provide a way to do this
rust_extensions = []
-setup(package_data={'': ['../docs/tutorial/*.txt', 'py.typed']},
- rust_extensions=rust_extensions,
- tests_require=tests_require)
+setup(
+ package_data={"": ["../docs/tutorial/*.txt", "py.typed"]},
+ rust_extensions=rust_extensions,
+ tests_require=tests_require,
+)