commit 1812282efe2193a1a08a1da9aa32544d9a2e134f from: Jelmer Vernooij via: GitHub date: Tue Jan 31 19:29:25 2023 UTC Merge pull request #1141 from jelmer/isort Sort Python import definitions with isort commit - ccc1a85a49ff69d4e0d7bdefeadb0d6f45948203 commit + 1812282efe2193a1a08a1da9aa32544d9a2e134f blob - 5978a2d7b2cfd50022ab25839db4ac94c33be44f blob + 655f17555d0d6375fdd1c5f19dcc1994e54fd185 --- bin/dul-receive-pack +++ bin/dul-receive-pack @@ -19,10 +19,11 @@ # License, Version 2.0. # -from dulwich.porcelain import receive_pack import os import sys +from dulwich.porcelain import receive_pack + if len(sys.argv) < 2: sys.stderr.write("usage: %s \n" % os.path.basename(sys.argv[0])) sys.exit(1) blob - bfc74892868d13839cfc6f7223ce5e9754355f71 blob + 547779266014fdba406a5e52646de2fa6b9a447e --- bin/dul-upload-pack +++ bin/dul-upload-pack @@ -19,10 +19,11 @@ # License, Version 2.0. # -from dulwich.porcelain import upload_pack import os import sys +from dulwich.porcelain import upload_pack + if len(sys.argv) < 2: sys.stderr.write("usage: %s \n" % os.path.basename(sys.argv[0])) sys.exit(1) blob - 1c3d298b61b13e78654c33b0ac9d6ce138153c45 blob + 523887ae6953f83486740acd18523de0e187e021 --- bin/dulwich +++ bin/dulwich @@ -22,4 +22,5 @@ import sys from dulwich.cli import main + sys.exit(main(sys.argv[1:])) blob - 375e394ca9ad09b2a6f624f61034d780d79fcaab blob + 5cf1bb3231ba0e5bc5edd0cdf96ff53a2e47906b --- dulwich/archive.py +++ dulwich/archive.py @@ -25,11 +25,11 @@ import posixpath import stat -import tarfile import struct -from os import SEEK_END -from io import BytesIO +import tarfile from contextlib import closing +from io import BytesIO +from os import SEEK_END class ChunkedBytesIO: blob - 52dd47408048903e9b085e5e14b4c1d20491bf35 blob + c7029ea47d6f6e00f4e92c923f7573c644d92749 --- dulwich/bundle.py +++ dulwich/bundle.py @@ -21,7 +21,8 @@ """Bundle format support. """ -from typing import Dict, List, Tuple, Optional, Union, Sequence +from typing import Dict, List, Optional, Sequence, Tuple, Union + from .pack import PackData, write_pack_data blob - 2595a2d28d8420bfdb25de6670bc1d282fc41ca1 blob + 74590c1f702b3e36cf0dc6d94516da09968c4648 --- dulwich/cli.py +++ dulwich/cli.py @@ -28,16 +28,16 @@ no means intended to be a full-blown Git command-line a way to test Dulwich. """ -import os -import sys -from getopt import getopt import argparse import optparse +import os import signal -from typing import Dict, Type, Optional +import sys +from getopt import getopt +from typing import Dict, Optional, Type from dulwich import porcelain -from dulwich.client import get_transport_and_path, GitProtocolError +from dulwich.client import GitProtocolError, get_transport_and_path from dulwich.errors import ApplyDeltaError from dulwich.index import Index from dulwich.objectspec import parse_commit blob - 4a2a83350706f7cfa28e7581baf9d6a1c97aefbb blob + 1f14f34b6940dd6ba890efcb0f36201d61590890 --- dulwich/client.py +++ dulwich/client.py @@ -38,100 +38,49 @@ Known capabilities that are not supported: * include-tag """ -from contextlib import closing -from io import BytesIO, BufferedReader import logging import os import select import socket import subprocess import sys -from typing import ( - Any, - Callable, - Dict, - List, - Iterable, - Iterator, - Optional, - Set, - Tuple, - IO, - Union, - TYPE_CHECKING, -) +from contextlib import closing +from io import BufferedReader, BytesIO +from typing import (IO, TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, + List, Optional, Set, Tuple, Union) +from urllib.parse import quote as urlquote +from urllib.parse import unquote as urlunquote +from urllib.parse import urljoin, urlparse, urlunparse, urlunsplit -from urllib.parse import ( - quote as urlquote, - unquote as urlunquote, - urlparse, - urljoin, - urlunsplit, - urlunparse, -) - if TYPE_CHECKING: import urllib3 import dulwich -from dulwich.config import get_xdg_config_home_path, Config, apply_instead_of -from dulwich.errors import ( - GitProtocolError, - NotGitRepository, - SendPackError, -) -from dulwich.protocol import ( - HangupException, - _RBUFSIZE, - agent_string, - capability_agent, - extract_capability_names, - CAPABILITY_AGENT, - CAPABILITY_DELETE_REFS, - CAPABILITY_INCLUDE_TAG, - CAPABILITY_MULTI_ACK, - CAPABILITY_MULTI_ACK_DETAILED, - CAPABILITY_OFS_DELTA, - CAPABILITY_QUIET, - CAPABILITY_REPORT_STATUS, - CAPABILITY_SHALLOW, - CAPABILITY_SYMREF, - CAPABILITY_SIDE_BAND_64K, - CAPABILITY_THIN_PACK, - CAPABILITIES_REF, - KNOWN_RECEIVE_CAPABILITIES, - KNOWN_UPLOAD_CAPABILITIES, - COMMAND_DEEPEN, - COMMAND_SHALLOW, - COMMAND_UNSHALLOW, - COMMAND_DONE, - COMMAND_HAVE, - COMMAND_WANT, - SIDE_BAND_CHANNEL_DATA, - SIDE_BAND_CHANNEL_PROGRESS, - SIDE_BAND_CHANNEL_FATAL, - PktLineParser, - Protocol, - TCP_GIT_PORT, - ZERO_SHA, - extract_capabilities, - parse_capability, - pkt_line, -) -from dulwich.pack import ( - write_pack_from_container, - UnpackedObject, - PackChunkGenerator, - PACK_SPOOL_FILE_MAX_SIZE, -) -from dulwich.refs import ( - read_info_refs, - PEELED_TAG_SUFFIX, - _import_remote_refs, -) +from dulwich.config import Config, apply_instead_of, get_xdg_config_home_path +from dulwich.errors import GitProtocolError, NotGitRepository, SendPackError +from dulwich.pack import (PACK_SPOOL_FILE_MAX_SIZE, PackChunkGenerator, + UnpackedObject, write_pack_from_container) +from dulwich.protocol import (_RBUFSIZE, CAPABILITIES_REF, CAPABILITY_AGENT, + CAPABILITY_DELETE_REFS, CAPABILITY_INCLUDE_TAG, + CAPABILITY_MULTI_ACK, + CAPABILITY_MULTI_ACK_DETAILED, + CAPABILITY_OFS_DELTA, CAPABILITY_QUIET, + CAPABILITY_REPORT_STATUS, CAPABILITY_SHALLOW, + CAPABILITY_SIDE_BAND_64K, CAPABILITY_SYMREF, + CAPABILITY_THIN_PACK, COMMAND_DEEPEN, + COMMAND_DONE, COMMAND_HAVE, COMMAND_SHALLOW, + COMMAND_UNSHALLOW, COMMAND_WANT, + KNOWN_RECEIVE_CAPABILITIES, + KNOWN_UPLOAD_CAPABILITIES, + SIDE_BAND_CHANNEL_DATA, SIDE_BAND_CHANNEL_FATAL, + SIDE_BAND_CHANNEL_PROGRESS, TCP_GIT_PORT, + ZERO_SHA, HangupException, PktLineParser, + Protocol, agent_string, capability_agent, + extract_capabilities, extract_capability_names, + parse_capability, pkt_line) +from dulwich.refs import PEELED_TAG_SUFFIX, _import_remote_refs, read_info_refs from dulwich.repo import Repo - # url2pathname is lazily imported url2pathname = None @@ -173,7 +122,7 @@ def _fileno_can_read(fileno): def _win32_peek_avail(handle): """Wrapper around PeekNamedPipe to check how many bytes are available.""" - from ctypes import byref, wintypes, windll + from ctypes import byref, windll, wintypes c_avail = wintypes.DWORD() c_message = wintypes.DWORD() @@ -720,7 +669,7 @@ class GitClient: def clone(self, path, target_path, mkdir: bool = True, bare=False, origin="origin", checkout=None, branch=None, progress=None, depth=None): """Clone a repository.""" - from .refs import _set_origin_head, _set_default_branch, _set_head + from .refs import _set_default_branch, _set_head, _set_origin_head if mkdir: os.mkdir(target_path) blob - ed0a493edccb5e0acdc795875c337ea4f82c5035 blob + cc60d9cf5eae4733226126bfbd3b569f34e1f95e --- dulwich/cloud/gcs.py +++ dulwich/cloud/gcs.py @@ -25,9 +25,9 @@ import posixpath import tempfile from ..object_store import BucketBasedObjectStore -from ..pack import PackData, Pack, load_pack_index_file, PACK_SPOOL_FILE_MAX_SIZE +from ..pack import (PACK_SPOOL_FILE_MAX_SIZE, Pack, PackData, + load_pack_index_file) - # TODO(jelmer): For performance, read ranges? blob - 88b8d106cea7e6c2a6c7833bb158b11b12a15d2a blob + 9b92f946642f1a60cd839833f8e878e9650cd0b4 --- dulwich/config.py +++ dulwich/config.py @@ -28,22 +28,11 @@ TODO: import os import sys -from typing import ( - BinaryIO, - Iterable, - Iterator, - KeysView, - List, - MutableMapping, - Optional, - Tuple, - Union, - overload, -) +from typing import (BinaryIO, Iterable, Iterator, KeysView, List, + MutableMapping, Optional, Tuple, Union, overload) from dulwich.file import GitFile - SENTINEL = object() blob - 9246e6219310868139ba04f314a7f89122fd8bfc blob + 5c9bfc3fa64353848b2b96a2cafbb9b98152c277 --- dulwich/contrib/diffstat.py +++ dulwich/contrib/diffstat.py @@ -32,9 +32,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import sys import re -from typing import Optional, Tuple, List +import sys +from typing import List, Optional, Tuple # only needs to detect git style diffs as this is for # use with dulwich blob - bb58d75c4c5fb3c566f6650b10e8eab1c9510dc4 blob + 73068f9e4cd253353985fb252533f8c341278440 --- dulwich/contrib/requests_vendor.py +++ dulwich/contrib/requests_vendor.py @@ -33,8 +33,9 @@ from io import BytesIO from requests import Session -from dulwich.client import AbstractHttpGitClient, HTTPUnauthorized, HTTPProxyUnauthorized, default_user_agent_string -from dulwich.errors import NotGitRepository, GitProtocolError +from dulwich.client import (AbstractHttpGitClient, HTTPProxyUnauthorized, + HTTPUnauthorized, default_user_agent_string) +from dulwich.errors import GitProtocolError, NotGitRepository class RequestsHttpGitClient(AbstractHttpGitClient): blob - e2f9625a256c98145d615e4932a54ebc082a9d2a blob + 9f961a6968e4bde16f4fd42516659664b9ae4cec --- dulwich/contrib/swift.py +++ dulwich/contrib/swift.py @@ -26,69 +26,32 @@ # TODO(fbo): Second attempt to _send() must be notified via real log # TODO(fbo): More logs for operations +import json import os +import posixpath import stat -import zlib +import sys import tempfile -import posixpath - import urllib.parse as urlparse - -from io import BytesIO +import zlib from configparser import ConfigParser +from io import BytesIO + from geventhttpclient import HTTPClient -from dulwich.greenthreads import ( - GreenThreadsMissingObjectFinder, -) - +from dulwich.greenthreads import GreenThreadsMissingObjectFinder from dulwich.lru_cache import LRUSizeCache -from dulwich.objects import ( - Blob, - Commit, - Tree, - Tag, - S_ISGITLINK, -) -from dulwich.object_store import ( - PackBasedObjectStore, - PACKDIR, - INFODIR, -) -from dulwich.pack import ( - PackData, - Pack, - PackIndexer, - PackStreamCopier, - write_pack_header, - compute_file_sha, - iter_sha1, - write_pack_index_v2, - load_pack_index_file, - read_pack_header, - _compute_object_size, - unpack_object, - write_pack_object, -) +from dulwich.object_store import INFODIR, PACKDIR, PackBasedObjectStore +from dulwich.objects import S_ISGITLINK, Blob, Commit, Tag, Tree +from dulwich.pack import (Pack, PackData, PackIndexer, PackStreamCopier, + _compute_object_size, compute_file_sha, iter_sha1, + load_pack_index_file, read_pack_header, + unpack_object, write_pack_header, + write_pack_index_v2, write_pack_object) from dulwich.protocol import TCP_GIT_PORT -from dulwich.refs import ( - InfoRefsContainer, - read_info_refs, - write_info_refs, -) -from dulwich.repo import ( - BaseRepo, - OBJECTDIR, -) -from dulwich.server import ( - Backend, - TCPGitServer, -) - -import json - -import sys - +from dulwich.refs import InfoRefsContainer, read_info_refs, write_info_refs +from dulwich.repo import OBJECTDIR, BaseRepo +from dulwich.server import Backend, TCPGitServer """ # Configuration file sample blob - b34ad77de57682ad4bd54e25204ffd0816e4fd66 blob + bec712ffbab3abf209f2ee2b8e8f0db1b9d661e2 --- dulwich/contrib/test_paramiko_vendor.py +++ dulwich/contrib/test_paramiko_vendor.py @@ -21,12 +21,11 @@ import socket import threading - -from dulwich.tests import TestCase - from io import StringIO from unittest import skipIf +from dulwich.tests import TestCase + try: import paramiko except ImportError: blob - 52b420a942b8dcf7a2b1d26131a6127646af1406 blob + a1bd2813ad5e848d28549b16134d9d0daddc8fa6 --- dulwich/contrib/test_swift.py +++ dulwich/contrib/test_swift.py @@ -22,28 +22,15 @@ """Tests for dulwich.contrib.swift.""" +import json import posixpath - -from time import time from io import BytesIO, StringIO - +from time import time from unittest import skipIf -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.test_object_store import ( - ObjectStoreTests, -) -from dulwich.objects import ( - Blob, - Commit, - Tree, - Tag, - parse_timezone, -) - -import json +from dulwich.objects import Blob, Commit, Tag, Tree, parse_timezone +from dulwich.tests import TestCase +from dulwich.tests.test_object_store import ObjectStoreTests missing_libs = [] blob - 461f75f80d1fda5589fcb49bcce975b91e6c4ae3 blob + 2d2ca91c6d842fa944ab9d086593e05aaf848200 --- dulwich/contrib/test_swift_smoke.py +++ dulwich/contrib/test_swift_smoke.py @@ -34,22 +34,16 @@ DULWICH_SWIFT_CFG=/tmp/conf.cfg PYTHONPATH=. python -m """ import os -import unittest -import tempfile import shutil +import tempfile +import unittest import gevent from gevent import monkey monkey.patch_all() -from dulwich import ( # noqa:E402 - server, - repo, - index, - client, - objects, -) +from dulwich import client, index, objects, repo, server # noqa:E402 from dulwich.contrib import swift # noqa:E402 blob - 5156800fe8def62d6cae796f08df3cdc7ee393e5 blob + 6ba691b59e601f082022e4a3280a055b94ed35a2 --- dulwich/diff_tree.py +++ dulwich/diff_tree.py @@ -20,23 +20,14 @@ """Utilities for diffing files and trees.""" -from collections import ( - defaultdict, - namedtuple, -) - +import stat +from collections import defaultdict, namedtuple from io import BytesIO from itertools import chain -import stat -from typing import List, Dict, Optional +from typing import Dict, List, Optional -from dulwich.objects import ( - S_ISGITLINK, - TreeEntry, - Tree, -) +from dulwich.objects import S_ISGITLINK, Tree, TreeEntry - # TreeChange type constants. CHANGE_ADD = "add" CHANGE_MODIFY = "modify" @@ -640,10 +631,7 @@ _merge_entries_py = _merge_entries _count_blocks_py = _count_blocks try: # Try to import C versions - from dulwich._diff_tree import ( # type: ignore - _is_tree, - _merge_entries, - _count_blocks, - ) + from dulwich._diff_tree import (_count_blocks, _is_tree, # type: ignore + _merge_entries) except ImportError: pass blob - e6fa896832f5911b5d0f0e9465b8e15bd56369f9 blob + 7c16b3ea6b681aa4396cd4dcfaddd593cc6eb43b --- dulwich/fastexport.py +++ dulwich/fastexport.py @@ -21,28 +21,17 @@ """Fast export/import functionality.""" -from dulwich.index import ( - commit_tree, -) -from dulwich.objects import ( - Blob, - Commit, - Tag, - ZERO_SHA, -) -from dulwich.object_store import ( - iter_tree_contents, -) -from fastimport import ( - commands, - errors as fastimport_errors, - parser, - processor, -) - import stat +from fastimport import commands +from fastimport import errors as fastimport_errors +from fastimport import parser, processor +from dulwich.index import commit_tree +from dulwich.object_store import iter_tree_contents +from dulwich.objects import ZERO_SHA, Blob, Commit, Tag + + def split_email(text): (name, email) = text.rsplit(b" <", 1) return (name, email.rstrip(b">")) blob - e15278e7c7a4c3eec5139427fcf5720b06ea3a4a blob + 1fcbcd6f6a12c7c877d0e599959136323cc32b18 --- dulwich/graph.py +++ dulwich/graph.py @@ -22,8 +22,8 @@ Implementation of merge-base following the approach of git """ -from typing import Deque from collections import deque +from typing import Deque def _find_lcas(lookup_parents, c1, c2s): blob - 4a56f46ef02872dde132dd716563f9041644c6d1 blob + e416df7a289b69fb12f631168deb92e50ac23217 --- dulwich/greenthreads.py +++ dulwich/greenthreads.py @@ -25,15 +25,9 @@ import gevent from gevent import pool -from dulwich.objects import ( - Commit, - Tag, -) -from dulwich.object_store import ( - MissingObjectFinder, - _collect_ancestors, - _collect_filetree_revs, -) +from dulwich.object_store import (MissingObjectFinder, _collect_ancestors, + _collect_filetree_revs) +from dulwich.objects import Commit, Tag def _split_commits_and_tags(obj_store, lst, *, ignore_unknown=False, pool=None): blob - e4d27648c5863caf186bdb64f40dbd0114b5bdcb blob + 5ceffc4230f4389d054b772c8ec89939573fb4ec --- dulwich/hooks.py +++ dulwich/hooks.py @@ -23,9 +23,7 @@ import os import subprocess -from dulwich.errors import ( - HookError, -) +from dulwich.errors import HookError class Hook: blob - eed363696651eea552493e2f53a2697e71dd74a7 blob + c7c9f616c41f56e0a917484a3f05dbaeaf2ee590 --- dulwich/ignore.py +++ dulwich/ignore.py @@ -24,20 +24,13 @@ For details for the matching rules, see https://git-sc import os.path import re -from typing import ( - BinaryIO, - Iterable, - List, - Optional, - TYPE_CHECKING, - Dict, - Union, -) +from typing import (TYPE_CHECKING, BinaryIO, Dict, Iterable, List, Optional, + Union) if TYPE_CHECKING: from dulwich.repo import Repo -from dulwich.config import get_xdg_config_home_path, Config +from dulwich.config import Config, get_xdg_config_home_path def _translate_segment(segment: bytes) -> bytes: blob - 4b13df9eb1147da3efc5e3906ceffad403b82581 blob + bfd7da39a6eada661c7a6843f9706c06d1bb622a --- dulwich/index.py +++ dulwich/index.py @@ -25,36 +25,14 @@ import os import stat import struct import sys -from typing import ( - Any, - BinaryIO, - Callable, - Dict, - List, - Optional, - Iterable, - Iterator, - Tuple, - Union, -) +from typing import (Any, BinaryIO, Callable, Dict, Iterable, Iterator, List, + Optional, Tuple, Union) from dulwich.file import GitFile -from dulwich.objects import ( - Blob, - S_IFGITLINK, - S_ISGITLINK, - Tree, - hex_to_sha, - sha_to_hex, - ObjectID, -) -from dulwich.object_store import iter_tree_contents -from dulwich.pack import ( - SHA1Reader, - SHA1Writer, - ObjectContainer, -) - +from dulwich.object_store import iter_tree_contents +from dulwich.objects import (S_IFGITLINK, S_ISGITLINK, Blob, ObjectID, Tree, + hex_to_sha, sha_to_hex) +from dulwich.pack import ObjectContainer, SHA1Reader, SHA1Writer # TODO(jelmer): Switch to dataclass? IndexEntry = collections.namedtuple( blob - bc9f914b78a2db4e086ec3a444f4b070ada77045 blob + ea66c655778ea4ef222849dc5ddfceacce215893 --- dulwich/lru_cache.py +++ dulwich/lru_cache.py @@ -20,9 +20,9 @@ # """A simple least-recently-used (LRU) cache.""" - -from typing import Generic, TypeVar, Optional, Callable, Dict, Iterable, Iterator +from typing import (Callable, Dict, Generic, Iterable, Iterator, Optional, + TypeVar) _null_key = object() blob - dcbb8d8601fb565df7a97da77232808dbbe6975e blob + 8888696eb32096633c2186145ded8b46ab4e66d2 --- dulwich/object_store.py +++ dulwich/object_store.py @@ -22,61 +22,34 @@ """Git object store interfaces and implementation.""" -from contextlib import suppress -from io import BytesIO import os import stat import sys import warnings +from contextlib import suppress +from io import BytesIO +from typing import (Callable, Dict, Iterable, Iterator, List, Optional, + Sequence, Set, Tuple, cast) -from typing import Callable, Dict, List, Optional, Tuple, Iterator, Set, Iterable, Sequence, cast - try: from typing import Protocol except ImportError: # python << 3.8 from typing_extensions import Protocol # type: ignore -from dulwich.errors import ( - NotTreeError, -) +from dulwich.errors import NotTreeError from dulwich.file import GitFile -from dulwich.objects import ( - ObjectID, - Commit, - ShaFile, - Tag, - Tree, - Blob, - ZERO_SHA, - hex_to_sha, - sha_to_hex, - hex_to_filename, - S_ISGITLINK, - TreeEntry, - object_class, - valid_hexsha, -) -from dulwich.pack import ( - ObjectContainer, - Pack, - PackData, - PackHint, - PackInflater, - PackFileDisappeared, - UnpackedObject, - extend_pack, - load_pack_index_file, - iter_sha1, - full_unpacked_object, - generate_unpacked_objects, - pack_objects_to_data, - write_pack_index, - write_pack_data, - PackIndexer, - PackStreamCopier, - PackedObjectContainer, - PACK_SPOOL_FILE_MAX_SIZE, -) +from dulwich.objects import (S_ISGITLINK, ZERO_SHA, Blob, Commit, ObjectID, + ShaFile, Tag, Tree, TreeEntry, hex_to_filename, + hex_to_sha, object_class, sha_to_hex, + valid_hexsha) +from dulwich.pack import (PACK_SPOOL_FILE_MAX_SIZE, ObjectContainer, Pack, + PackData, PackedObjectContainer, PackFileDisappeared, + PackHint, PackIndexer, PackInflater, + PackStreamCopier, UnpackedObject, extend_pack, + full_unpacked_object, generate_unpacked_objects, + iter_sha1, load_pack_index_file, + pack_objects_to_data, write_pack_data, + write_pack_index) from dulwich.protocol import DEPTH_INFINITE from dulwich.refs import PEELED_TAG_SUFFIX, Ref blob - b5909c97bd4f1352371fb741b0fbf9f0d6f09170 blob + 54dad1a28e6e553b9328e1677078fe80bc1a757c --- dulwich/objects.py +++ dulwich/objects.py @@ -22,37 +22,23 @@ """Access to base git objects.""" import binascii -from io import BytesIO -from collections import namedtuple import os import posixpath import stat -from typing import ( - Optional, - Dict, - Iterable, - Union, - Type, - Iterator, - List, -) import warnings import zlib -from _hashlib import HASH +from collections import namedtuple from hashlib import sha1 +from io import BytesIO +from typing import Dict, Iterable, Iterator, List, Optional, Type, Union + +from _hashlib import HASH -from dulwich.errors import ( - ChecksumMismatch, - NotBlobError, - NotCommitError, - NotTagError, - NotTreeError, - ObjectFormatException, - FileFormatException, -) +from dulwich.errors import (ChecksumMismatch, FileFormatException, + NotBlobError, NotCommitError, NotTagError, + NotTreeError, ObjectFormatException) from dulwich.file import GitFile - ZERO_SHA = b"0" * 40 # Header fields for commits blob - 044e65809841079ebc98cb8ebe5ec15e50005259 blob + 95e5d1718f15aad4e0d34e272fd7a4eec94a926f --- dulwich/objectspec.py +++ dulwich/objectspec.py @@ -20,7 +20,7 @@ """Object specification.""" -from typing import Union, List, Tuple +from typing import List, Tuple, Union def to_bytes(text): blob - 435565fbe3796931c52644f31208f03a57ee4c69 blob + 6dd8ba484fd5d35b923e5307556454df49fdcab1 --- dulwich/pack.py +++ dulwich/pack.py @@ -32,25 +32,23 @@ match for the object name. You then use the pointer go a pointer in to the corresponding packfile. """ -from collections import defaultdict - import binascii +from collections import defaultdict, deque from contextlib import suppress from io import BytesIO, UnsupportedOperation -from collections import ( - deque, -) + try: from cdifflib import CSequenceMatcher as SequenceMatcher except ModuleNotFoundError: from difflib import SequenceMatcher -import struct -from itertools import chain - import os +import struct import sys -from typing import Optional, Callable, Tuple, List, Deque, Union, Iterable, Iterator, Dict, TypeVar, Generic, Sequence, Set, BinaryIO +from itertools import chain +from typing import (BinaryIO, Callable, Deque, Dict, Generic, Iterable, + Iterator, List, Optional, Sequence, Set, Tuple, TypeVar, + Union) try: from typing import Protocol @@ -58,14 +56,10 @@ except ImportError: # python << 3.8 from typing_extensions import Protocol # type: ignore import warnings - +import zlib from hashlib import sha1 -from os import ( - SEEK_CUR, - SEEK_END, -) +from os import SEEK_CUR, SEEK_END from struct import unpack_from -import zlib try: import mmap @@ -78,22 +72,11 @@ else: if sys.platform == "Plan9": has_mmap = False -from dulwich.errors import ( - ApplyDeltaError, - ChecksumMismatch, -) +from dulwich.errors import ApplyDeltaError, ChecksumMismatch from dulwich.file import GitFile -from dulwich.lru_cache import ( - LRUSizeCache, -) -from dulwich.objects import ( - ShaFile, - ObjectID, - hex_to_sha, - sha_to_hex, - object_header, -) - +from dulwich.lru_cache import LRUSizeCache +from dulwich.objects import (ObjectID, ShaFile, hex_to_sha, object_header, + sha_to_hex) OFS_DELTA = 6 REF_DELTA = 7 @@ -2608,9 +2591,7 @@ def extend_pack(f: BinaryIO, object_ids: Set[ObjectID] try: - from dulwich._pack import ( # type: ignore # noqa: F811 - apply_delta, - bisect_find_sha, - ) + from dulwich._pack import (apply_delta, # type: ignore # noqa: F811 + bisect_find_sha) except ImportError: pass blob - 3652e33424e0937c1a3cb683458755689c7d5951 blob + 37555616de107718f1c1c5ac6343ca4015480f55 --- dulwich/patch.py +++ dulwich/patch.py @@ -24,16 +24,12 @@ These patches are basically unified diffs with some ex on. """ -from difflib import SequenceMatcher import email.parser import time -from typing import Union, TextIO, BinaryIO, Optional +from difflib import SequenceMatcher +from typing import BinaryIO, Optional, TextIO, Union -from dulwich.objects import ( - Blob, - Commit, - S_ISGITLINK, -) +from dulwich.objects import S_ISGITLINK, Blob, Commit from dulwich.pack import ObjectContainer FIRST_FEW_BYTES = 8000 blob - daf6b6297fe85abdfeab3a58f4592559aa8b2514 blob + b5074b74b48c50818bb5642b4a1dde101ea94cc6 --- dulwich/porcelain.py +++ dulwich/porcelain.py @@ -63,98 +63,43 @@ to the repository root. Functions should generally accept both unicode strings and bytestrings """ -from collections import namedtuple -from contextlib import ( - closing, - contextmanager, -) -from io import BytesIO, RawIOBase import datetime import os -from pathlib import Path import posixpath import stat import sys import time -from typing import ( - Optional, - Tuple, - Union, -) +from collections import namedtuple +from contextlib import closing, contextmanager +from io import BytesIO, RawIOBase +from pathlib import Path +from typing import Optional, Tuple, Union -from dulwich.archive import ( - tar_stream, -) -from dulwich.client import ( - get_transport_and_path, -) -from dulwich.config import ( - Config, - ConfigFile, - StackedConfig, - read_submodules, -) -from dulwich.diff_tree import ( - CHANGE_ADD, - CHANGE_DELETE, - CHANGE_MODIFY, - CHANGE_RENAME, - CHANGE_COPY, - RENAME_CHANGE_TYPES, -) -from dulwich.errors import ( - SendPackError, -) -from dulwich.graph import ( - can_fast_forward, -) +from dulwich.archive import tar_stream +from dulwich.client import get_transport_and_path +from dulwich.config import Config, ConfigFile, StackedConfig, read_submodules +from dulwich.diff_tree import (CHANGE_ADD, CHANGE_COPY, CHANGE_DELETE, + CHANGE_MODIFY, CHANGE_RENAME, + RENAME_CHANGE_TYPES) +from dulwich.errors import SendPackError +from dulwich.graph import can_fast_forward from dulwich.ignore import IgnoreFilterManager -from dulwich.index import ( - blob_from_path_and_stat, - get_unstaged_changes, - build_file_from_blob, - _fs_to_tree_path, -) -from dulwich.object_store import ( - tree_lookup_path, -) -from dulwich.objects import ( - Commit, - Tag, - format_timezone, - parse_timezone, - pretty_format_tree_entry, -) -from dulwich.objectspec import ( - parse_commit, - parse_object, - parse_ref, - parse_reftuples, - parse_tree, -) -from dulwich.pack import ( - write_pack_index, - write_pack_from_container, -) -from dulwich.patch import write_tree_diff -from dulwich.protocol import ( - Protocol, - ZERO_SHA, -) -from dulwich.refs import ( - LOCAL_BRANCH_PREFIX, - LOCAL_TAG_PREFIX, - _import_remote_refs, -) +from dulwich.index import (_fs_to_tree_path, blob_from_path_and_stat, + build_file_from_blob, get_unstaged_changes) +from dulwich.object_store import tree_lookup_path +from dulwich.objects import (Commit, Tag, format_timezone, parse_timezone, + pretty_format_tree_entry) +from dulwich.objectspec import (parse_commit, parse_object, parse_ref, + parse_reftuples, parse_tree) +from dulwich.pack import write_pack_from_container, write_pack_index +from dulwich.patch import write_tree_diff +from dulwich.protocol import ZERO_SHA, Protocol +from dulwich.refs import (LOCAL_BRANCH_PREFIX, LOCAL_TAG_PREFIX, + _import_remote_refs) from dulwich.repo import BaseRepo, Repo -from dulwich.server import ( - FileSystemBackend, - TCPGitServer, - ReceivePackHandler, - UploadPackHandler, - update_server_info as server_update_server_info, -) - +from dulwich.server import (FileSystemBackend, ReceivePackHandler, + TCPGitServer, UploadPackHandler) +from dulwich.server import update_server_info as server_update_server_info # Module level tuple definition for status output GitStatus = namedtuple("GitStatus", "staged unstaged untracked") @@ -1511,12 +1456,8 @@ def web_daemon(path=".", address=None, port=None): address: Optional address to listen on (defaults to ::) port: Optional port to listen on (defaults to 80) """ - from dulwich.web import ( - make_wsgi_chain, - make_server, - WSGIRequestHandlerLogger, - WSGIServerLogger, - ) + from dulwich.web import (WSGIRequestHandlerLogger, WSGIServerLogger, + make_server, make_wsgi_chain) backend = FileSystemBackend(path) app = make_wsgi_chain(backend) blob - 2013a0b14437c3e7d8e8e27adef3b40793520923 blob + 82d7c93ba44596757c0cfb1bb5c5e26dae3d0375 --- dulwich/protocol.py +++ dulwich/protocol.py @@ -22,15 +22,10 @@ """Generic functions for talking the git smart server protocol.""" from io import BytesIO -from os import ( - SEEK_END, -) +from os import SEEK_END import dulwich -from dulwich.errors import ( - HangupException, - GitProtocolError, -) +from dulwich.errors import GitProtocolError, HangupException TCP_GIT_PORT = 9418 blob - 0574ddc3db51423099b3a32dedf6b59e9a810170 blob + edab42b7aa96cecf5ccd5f3493de76d3fceee3b9 --- dulwich/reflog.py +++ dulwich/reflog.py @@ -23,11 +23,7 @@ import collections -from dulwich.objects import ( - format_timezone, - parse_timezone, - ZERO_SHA, -) +from dulwich.objects import ZERO_SHA, format_timezone, parse_timezone Entry = collections.namedtuple( "Entry", blob - 1fc178af8699bbec8acab64786a05c1d2d6e3244 blob + e424674780d730e402427d7999c92765528b20e3 --- dulwich/refs.py +++ dulwich/refs.py @@ -22,27 +22,15 @@ """Ref handling. """ -from contextlib import suppress import os -from typing import Dict, Optional import warnings +from contextlib import suppress +from typing import Dict, Optional -from dulwich.errors import ( - PackedRefsException, - RefFormatError, -) -from dulwich.objects import ( - git_line, - valid_hexsha, - ZERO_SHA, - Tag, - ObjectID, -) +from dulwich.errors import PackedRefsException, RefFormatError +from dulwich.file import GitFile, ensure_dir_exists +from dulwich.objects import ZERO_SHA, ObjectID, Tag, git_line, valid_hexsha from dulwich.pack import ObjectContainer -from dulwich.file import ( - GitFile, - ensure_dir_exists, -) Ref = bytes blob - d331e04e8141219df0f6cf6c4311443114a1429a blob + a0839bdb675fbf5e928aa5ed3675169d4631af0c --- dulwich/repo.py +++ dulwich/repo.py @@ -28,27 +28,15 @@ local disk (Repo). """ -from io import BytesIO import os -import sys import stat +import sys import time -from typing import ( - Optional, - BinaryIO, - Callable, - Tuple, - TYPE_CHECKING, - FrozenSet, - List, - Dict, - Union, - Iterable, - Set -) import warnings +from io import BytesIO +from typing import (TYPE_CHECKING, BinaryIO, Callable, Dict, FrozenSet, + Iterable, List, Optional, Set, Tuple, Union) - if TYPE_CHECKING: # There are no circular imports here, but we try to defer imports as long # as possible to reduce start-up time for anything that doesn't need @@ -56,72 +44,27 @@ if TYPE_CHECKING: from dulwich.config import StackedConfig, ConfigFile from dulwich.index import Index -from dulwich.errors import ( - NoIndexPresent, - NotBlobError, - NotCommitError, - NotGitRepository, - NotTreeError, - NotTagError, - CommitError, - RefFormatError, - HookError, -) -from dulwich.file import ( - GitFile, -) -from dulwich.object_store import ( - DiskObjectStore, - MemoryObjectStore, - MissingObjectFinder, - PackBasedObjectStore, - ObjectStoreGraphWalker, - peel_sha, -) -from dulwich.objects import ( - check_hexsha, - valid_hexsha, - Blob, - Commit, - ShaFile, - Tag, - Tree, - ObjectID, -) -from dulwich.pack import ( - generate_unpacked_objects -) - -from dulwich.hooks import ( - Hook, - PreCommitShellHook, - PostCommitShellHook, - CommitMsgShellHook, - PostReceiveShellHook, -) - +from dulwich.errors import (CommitError, HookError, NoIndexPresent, + NotBlobError, NotCommitError, NotGitRepository, + NotTagError, NotTreeError, RefFormatError) +from dulwich.file import GitFile +from dulwich.hooks import (CommitMsgShellHook, Hook, PostCommitShellHook, + PostReceiveShellHook, PreCommitShellHook) from dulwich.line_ending import BlobNormalizer, TreeBlobNormalizer - -from dulwich.refs import ( # noqa: F401 - Ref, - ANNOTATED_TAG_SUFFIX, - LOCAL_BRANCH_PREFIX, - LOCAL_TAG_PREFIX, - serialize_refs, - check_ref_format, - RefsContainer, - DictRefsContainer, - InfoRefsContainer, - DiskRefsContainer, - read_packed_refs, - read_packed_refs_with_peeled, - write_packed_refs, - SYMREF, - _set_default_branch, - _set_head, - _set_origin_head, -) - +from dulwich.object_store import (DiskObjectStore, MemoryObjectStore, + MissingObjectFinder, ObjectStoreGraphWalker, + PackBasedObjectStore, peel_sha) +from dulwich.objects import (Blob, Commit, ObjectID, ShaFile, Tag, Tree, + check_hexsha, valid_hexsha) +from dulwich.pack import generate_unpacked_objects +from dulwich.refs import (ANNOTATED_TAG_SUFFIX, # noqa: F401 + LOCAL_BRANCH_PREFIX, LOCAL_TAG_PREFIX, SYMREF, + DictRefsContainer, DiskRefsContainer, + InfoRefsContainer, Ref, RefsContainer, + _set_default_branch, _set_head, _set_origin_head, + check_ref_format, read_packed_refs, + read_packed_refs_with_peeled, serialize_refs, + write_packed_refs) CONTROLDIR = ".git" OBJECTDIR = "objects" @@ -716,7 +659,7 @@ class BaseRepo: Returns: `Config` instance for this repository """ - from dulwich.config import StackedConfig, ConfigFile + from dulwich.config import ConfigFile, StackedConfig local_config = self.get_config() backends: List[ConfigFile] = [local_config] @@ -1368,12 +1311,9 @@ class Repo(BaseRepo): fs_paths = [fs_paths] fs_paths = list(fs_paths) - from dulwich.index import ( - blob_from_path_and_stat, - index_entry_from_stat, - index_entry_from_directory, - _fs_to_tree_path, - ) + from dulwich.index import (_fs_to_tree_path, blob_from_path_and_stat, + index_entry_from_directory, + index_entry_from_stat) index = self.open_index() blob_normalizer = self.get_blob_normalizer() @@ -1423,10 +1363,7 @@ class Repo(BaseRepo): fs_paths: a list of files to unstage, relative to the repository path """ - from dulwich.index import ( - IndexEntry, - _fs_to_tree_path, - ) + from dulwich.index import IndexEntry, _fs_to_tree_path index = self.open_index() try: @@ -1577,11 +1514,9 @@ class Repo(BaseRepo): Args: tree: Tree SHA to reset to, None for current HEAD tree. """ - from dulwich.index import ( - build_index_from_tree, - validate_path_element_default, - validate_path_element_ntfs, - ) + from dulwich.index import (build_index_from_tree, + validate_path_element_default, + validate_path_element_ntfs) if tree is None: head = self[b"HEAD"] blob - b97d33048f27a3d47af4b0d3edae818b1534211e blob + 8831e16b98652b5f86e2eb94f2d4be432aa0e2b7 --- dulwich/server.py +++ dulwich/server.py @@ -43,99 +43,51 @@ Currently supported capabilities: """ import collections -from functools import partial import os import socket import sys import time -from typing import List, Tuple, Dict, Optional, Iterable, Set +from functools import partial +from typing import Dict, Iterable, List, Optional, Set, Tuple try: from typing import Protocol as TypingProtocol except ImportError: # python < 3.8 from typing_extensions import Protocol as TypingProtocol # type: ignore +import socketserver import zlib -import socketserver - -from dulwich.archive import tar_stream -from dulwich.errors import ( - ApplyDeltaError, - ChecksumMismatch, - GitProtocolError, - HookError, - NotGitRepository, - UnexpectedCommandError, - ObjectFormatException, -) from dulwich import log_utils -from dulwich.objects import ( - Commit, - ObjectID, - valid_hexsha, -) -from dulwich.object_store import ( - peel_sha, -) -from dulwich.pack import ( - write_pack_from_container, - ObjectContainer, - PackedObjectContainer, -) -from dulwich.protocol import ( - BufferedPktLineWriter, - capability_agent, - CAPABILITIES_REF, - CAPABILITY_AGENT, - CAPABILITY_DELETE_REFS, - CAPABILITY_INCLUDE_TAG, - CAPABILITY_MULTI_ACK_DETAILED, - CAPABILITY_MULTI_ACK, - CAPABILITY_NO_DONE, - CAPABILITY_NO_PROGRESS, - CAPABILITY_OFS_DELTA, - CAPABILITY_QUIET, - CAPABILITY_REPORT_STATUS, - CAPABILITY_SHALLOW, - CAPABILITY_SIDE_BAND_64K, - CAPABILITY_THIN_PACK, - COMMAND_DEEPEN, - COMMAND_DONE, - COMMAND_HAVE, - COMMAND_SHALLOW, - COMMAND_UNSHALLOW, - COMMAND_WANT, - MULTI_ACK, - MULTI_ACK_DETAILED, - Protocol, - ReceivableProtocol, - SIDE_BAND_CHANNEL_DATA, - SIDE_BAND_CHANNEL_PROGRESS, - SIDE_BAND_CHANNEL_FATAL, - SINGLE_ACK, - TCP_GIT_PORT, - ZERO_SHA, - ack_type, - extract_capabilities, - extract_want_line_capabilities, - symref_capabilities, - format_ref_line, - format_shallow_line, - format_unshallow_line, - format_ack_line, - NAK_LINE, -) -from dulwich.refs import ( - RefsContainer, - PEELED_TAG_SUFFIX, - write_info_refs, -) -from dulwich.repo import ( - BaseRepo, - Repo, -) - +from dulwich.archive import tar_stream +from dulwich.errors import (ApplyDeltaError, ChecksumMismatch, + GitProtocolError, HookError, NotGitRepository, + ObjectFormatException, UnexpectedCommandError) +from dulwich.object_store import peel_sha +from dulwich.objects import Commit, ObjectID, valid_hexsha +from dulwich.pack import (ObjectContainer, PackedObjectContainer, + write_pack_from_container) +from dulwich.protocol import (CAPABILITIES_REF, CAPABILITY_AGENT, + CAPABILITY_DELETE_REFS, CAPABILITY_INCLUDE_TAG, + CAPABILITY_MULTI_ACK, + CAPABILITY_MULTI_ACK_DETAILED, + CAPABILITY_NO_DONE, CAPABILITY_NO_PROGRESS, + CAPABILITY_OFS_DELTA, CAPABILITY_QUIET, + CAPABILITY_REPORT_STATUS, CAPABILITY_SHALLOW, + CAPABILITY_SIDE_BAND_64K, CAPABILITY_THIN_PACK, + COMMAND_DEEPEN, COMMAND_DONE, COMMAND_HAVE, + COMMAND_SHALLOW, COMMAND_UNSHALLOW, COMMAND_WANT, + MULTI_ACK, MULTI_ACK_DETAILED, NAK_LINE, + SIDE_BAND_CHANNEL_DATA, SIDE_BAND_CHANNEL_FATAL, + SIDE_BAND_CHANNEL_PROGRESS, SINGLE_ACK, + TCP_GIT_PORT, ZERO_SHA, BufferedPktLineWriter, + Protocol, ReceivableProtocol, ack_type, + capability_agent, extract_capabilities, + extract_want_line_capabilities, format_ack_line, + format_ref_line, format_shallow_line, + format_unshallow_line, symref_capabilities) +from dulwich.refs import PEELED_TAG_SUFFIX, RefsContainer, write_info_refs +from dulwich.repo import BaseRepo, Repo logger = log_utils.getLogger(__name__) blob - 2b0c3697e479f8115e023ae3e58bbf6014660bad blob + e0d5af799a514d6454f59cb6a1455a78c0757a09 --- dulwich/stash.py +++ dulwich/stash.py @@ -24,13 +24,9 @@ import os from dulwich.file import GitFile -from dulwich.index import ( - commit_tree, - iter_fresh_objects, -) +from dulwich.index import commit_tree, iter_fresh_objects from dulwich.reflog import drop_reflog_entry, read_reflog - DEFAULT_STASH_REF = b"refs/stash" blob - 5bc44c27cdd444437b8d31b0fba3b9b086b65ed5 blob + c7137ac2d74dc01b86f461fadcdd58f59498f5c9 --- dulwich/submodule.py +++ dulwich/submodule.py @@ -22,6 +22,7 @@ """ from typing import Iterator, Tuple + from .object_store import iter_tree_contents from .objects import S_ISGITLINK blob - 0adbc6049f4b6b1ce414eb14daa963dc75b30697 blob + 6a9bbcf54b7d834597c5bda5a22f1446566cfb2c --- dulwich/tests/__init__.py +++ dulwich/tests/__init__.py @@ -34,16 +34,11 @@ import shutil import subprocess import sys import tempfile - - # If Python itself provides an exception, use that import unittest -from unittest import ( # noqa: F401 - SkipTest, - TestCase as _TestCase, - skipIf, - expectedFailure, -) +from unittest import SkipTest +from unittest import TestCase as _TestCase # noqa: F401 +from unittest import expectedFailure, skipIf class TestCase(_TestCase): @@ -163,9 +158,6 @@ def tutorial_test_suite(): import dulwich.client import dulwich.config import dulwich.index - import dulwich.reflog - import dulwich.repo - import dulwich.server import dulwich.patch # noqa: F401 tutorial = [ @@ -176,7 +168,7 @@ def tutorial_test_suite(): "remote", "conclusion", ] - tutorial_files = ["../../docs/tutorial/%s.txt" % name for name in tutorial] + tutorial_files = [f"../../docs/tutorial/{name}.txt" for name in tutorial] def setup(test): test.__old_cwd = os.getcwd() blob - a88d7ebed8003ef93f22f33ffc1a848f440d7cc3 blob + a7eb9576771665337751c93f5a65f35b8c36deec --- dulwich/tests/compat/server_utils.py +++ dulwich/tests/compat/server_utils.py @@ -26,21 +26,12 @@ import shutil import socket import tempfile -from dulwich.repo import Repo from dulwich.objects import hex_to_sha -from dulwich.protocol import ( - CAPABILITY_SIDE_BAND_64K, -) -from dulwich.server import ( - ReceivePackHandler, -) -from dulwich.tests.utils import ( - tear_down_repo, -) -from dulwich.tests.compat.utils import ( - run_git_or_fail, -) -from dulwich.tests.compat.utils import require_git_version +from dulwich.protocol import CAPABILITY_SIDE_BAND_64K +from dulwich.repo import Repo +from dulwich.server import ReceivePackHandler +from dulwich.tests.compat.utils import require_git_version, run_git_or_fail +from dulwich.tests.utils import tear_down_repo class _StubRepo: blob - 05aa84ec2945c2580641492f4d5c20f171b91900 blob + 02ab6c0a887864fd54fbdd96cf2418a586f5b7f5 --- dulwich/tests/compat/test_client.py +++ dulwich/tests/compat/test_client.py @@ -21,7 +21,7 @@ """Compatibility tests between the Dulwich client and the cgit server.""" import copy -from io import BytesIO +import http.server import os import select import signal @@ -31,32 +31,14 @@ import sys import tarfile import tempfile import threading - +from io import BytesIO from urllib.parse import unquote -import http.server - -from dulwich import ( - client, - file, - index, - protocol, - objects, - repo, -) -from dulwich.tests import ( - SkipTest, - expectedFailure, -) -from dulwich.tests.compat.utils import ( - CompatTestCase, - check_for_daemon, - import_repo_to_dir, - rmtree_ro, - run_git_or_fail, - _DEFAULT_GIT, -) - +from dulwich import client, file, index, objects, protocol, repo +from dulwich.tests import SkipTest, expectedFailure +from dulwich.tests.compat.utils import (_DEFAULT_GIT, CompatTestCase, + check_for_daemon, import_repo_to_dir, + rmtree_ro, run_git_or_fail) if sys.platform == "win32": import ctypes blob - 73c0a15a6370a40cddb1848ceb753bc42ad48a0a blob + 040c4c327e6e420a315bda48f4aa9bf143f7291e --- dulwich/tests/compat/test_pack.py +++ dulwich/tests/compat/test_pack.py @@ -27,24 +27,11 @@ import re import shutil import tempfile -from dulwich.pack import ( - write_pack, -) -from dulwich.objects import ( - Blob, -) -from dulwich.tests import ( - SkipTest, -) -from dulwich.tests.test_pack import ( - a_sha, - pack1_sha, - PackTests, -) -from dulwich.tests.compat.utils import ( - require_git_version, - run_git_or_fail, -) +from dulwich.objects import Blob +from dulwich.pack import write_pack +from dulwich.tests import SkipTest +from dulwich.tests.compat.utils import require_git_version, run_git_or_fail +from dulwich.tests.test_pack import PackTests, a_sha, pack1_sha _NON_DELTA_RE = re.compile(b"non delta: (?P\\d+) objects") blob - c0b0f72e77584693abc65dd8b9bced34ffaff708 blob + aabda17cef2118213f2d83ebbe0c365772b62258 --- dulwich/tests/compat/test_patch.py +++ dulwich/tests/compat/test_patch.py @@ -19,19 +19,14 @@ # """Tests related to patch compatibility with CGit.""" -from io import BytesIO import os import shutil import tempfile +from io import BytesIO from dulwich import porcelain -from dulwich.repo import ( - Repo, -) -from dulwich.tests.compat.utils import ( - CompatTestCase, - run_git_or_fail, -) +from dulwich.repo import Repo +from dulwich.tests.compat.utils import CompatTestCase, run_git_or_fail class CompatPatchTestCase(CompatTestCase): blob - 62349905117a246f721de71b5905d1f6a7ea3a2b blob + 14c7fcf18312c25d0551c9f50782c71dd96c18ca --- dulwich/tests/compat/test_porcelain.py +++ dulwich/tests/compat/test_porcelain.py @@ -26,16 +26,9 @@ import sys from unittest import skipIf from dulwich import porcelain -from dulwich.tests.utils import ( - build_commit_graph, -) -from dulwich.tests.compat.utils import ( - run_git_or_fail, - CompatTestCase, -) -from dulwich.tests.test_porcelain import ( - PorcelainGpgTestCase, -) +from dulwich.tests.compat.utils import CompatTestCase, run_git_or_fail +from dulwich.tests.test_porcelain import PorcelainGpgTestCase +from dulwich.tests.utils import build_commit_graph @skipIf(platform.python_implementation() == "PyPy" or sys.platform == "win32", "gpgme not easily available or supported on Windows and PyPy") blob - a42e5677fa5f7b8bc75c083fc0caf6a70dd8c8ea blob + c0191e0f9a547660a602592213ab0532b3b57e3b --- dulwich/tests/compat/test_repository.py +++ dulwich/tests/compat/test_repository.py @@ -21,24 +21,15 @@ """Compatibility tests for dulwich repositories.""" -from io import BytesIO -from itertools import chain import os import tempfile +from io import BytesIO +from itertools import chain -from dulwich.objects import ( - hex_to_sha, -) -from dulwich.repo import ( - check_ref_format, - Repo, -) -from dulwich.tests.compat.utils import ( - require_git_version, - rmtree_ro, - run_git_or_fail, - CompatTestCase, -) +from dulwich.objects import hex_to_sha +from dulwich.repo import Repo, check_ref_format +from dulwich.tests.compat.utils import (CompatTestCase, require_git_version, + rmtree_ro, run_git_or_fail) class ObjectStoreTestCase(CompatTestCase): blob - 15b8f42e87f0b28ce0d265eebe670be2b36db02c blob + 7fc5026db1f0e23c249d2d5fc3ddce48f34c6d46 --- dulwich/tests/compat/test_server.py +++ dulwich/tests/compat/test_server.py @@ -25,23 +25,15 @@ Warning: these tests should be fairly stable, but when Ctrl-C'ed. On POSIX systems, you can kill the tests with Ctrl-Z, "kill %". """ -import threading import os import sys +import threading -from dulwich.server import ( - DictBackend, - TCPGitServer, -) +from dulwich.server import DictBackend, TCPGitServer from dulwich.tests import skipIf -from dulwich.tests.compat.server_utils import ( - ServerTests, - NoSideBand64kReceivePackHandler, -) -from dulwich.tests.compat.utils import ( - CompatTestCase, - require_git_version, -) +from dulwich.tests.compat.server_utils import (NoSideBand64kReceivePackHandler, + ServerTests) +from dulwich.tests.compat.utils import CompatTestCase, require_git_version @skipIf(sys.platform == "win32", "Broken on windows, with very long fail time.") blob - 70cd6617bcd265b21f3ded5024bafa8cf33caad9 blob + 378c6f57b12084cf27f1d9fb9aa926b68114cba0 --- dulwich/tests/compat/test_utils.py +++ dulwich/tests/compat/test_utils.py @@ -20,10 +20,7 @@ """Tests for git compatibility utilities.""" -from dulwich.tests import ( - SkipTest, - TestCase, -) +from dulwich.tests import SkipTest, TestCase from dulwich.tests.compat import utils blob - 258b489c6cfdc9ffc304d26ec9b6fb0a1fa89ea3 blob + bf5754fb41c45cf1947531fd65ef7b7b94d3d7fd --- dulwich/tests/compat/test_web.py +++ dulwich/tests/compat/test_web.py @@ -25,36 +25,20 @@ warning: these tests should be fairly stable, but when Ctrl-C'ed. On POSIX systems, you can kill the tests with Ctrl-Z, "kill %". """ -import threading -from wsgiref import simple_server import sys +import threading from typing import Tuple +from wsgiref import simple_server -from dulwich.server import ( - DictBackend, - UploadPackHandler, - ReceivePackHandler, -) -from dulwich.tests import ( - SkipTest, - skipIf, -) -from dulwich.web import ( - make_wsgi_chain, - HTTPGitApplication, - WSGIRequestHandlerLogger, - WSGIServerLogger, -) +from dulwich.server import DictBackend, ReceivePackHandler, UploadPackHandler +from dulwich.tests import SkipTest, skipIf +from dulwich.tests.compat.server_utils import (NoSideBand64kReceivePackHandler, + ServerTests) +from dulwich.tests.compat.utils import CompatTestCase +from dulwich.web import (HTTPGitApplication, WSGIRequestHandlerLogger, + WSGIServerLogger, make_wsgi_chain) -from dulwich.tests.compat.server_utils import ( - ServerTests, - NoSideBand64kReceivePackHandler, -) -from dulwich.tests.compat.utils import ( - CompatTestCase, -) - @skipIf(sys.platform == "win32", "Broken on windows, with very long fail time.") class WebTests(ServerTests): """Base tests for web server tests. blob - 4f4e1374561513a61e65a52f4bb934bd248954f6 blob + d823d2349e554cc40b195e51896d0c073b4980f2 --- dulwich/tests/compat/utils.py +++ dulwich/tests/compat/utils.py @@ -32,13 +32,9 @@ import tempfile import time from typing import Tuple -from dulwich.repo import Repo from dulwich.protocol import TCP_GIT_PORT - -from dulwich.tests import ( - SkipTest, - TestCase, -) +from dulwich.repo import Repo +from dulwich.tests import SkipTest, TestCase _DEFAULT_GIT = "git" _VERSION_LEN = 4 blob - 936759e01d08454de856aeeddad5ae0a1695756d blob + bf188026b8c55e19f3b7445bbc30cecd65d3781f --- dulwich/tests/test_archive.py +++ dulwich/tests/test_archive.py @@ -20,25 +20,16 @@ """Tests for archive support.""" -from io import BytesIO -import tarfile import struct +import tarfile +from io import BytesIO from unittest import skipUnless from dulwich.archive import tar_stream -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - Blob, - Tree, -) -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.utils import ( - build_commit_graph, -) +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import Blob, Tree +from dulwich.tests import TestCase +from dulwich.tests.utils import build_commit_graph try: from unittest.mock import patch blob - fc5e022dcd692840f0dadaae729cbe5057aa1bfb blob + 82148488183c11edcf5e048d80f9b8e7fe3acb7d --- dulwich/tests/test_blackbox.py +++ dulwich/tests/test_blackbox.py @@ -20,15 +20,11 @@ """Blackbox tests for Dulwich commands.""" -import tempfile import shutil +import tempfile -from dulwich.repo import ( - Repo, -) -from dulwich.tests import ( - BlackboxTestCase, -) +from dulwich.repo import Repo +from dulwich.tests import BlackboxTestCase class GitReceivePackTests(BlackboxTestCase): blob - 34edefbf4fb33d5c445db4648b5bf140782b8834 blob + 22c4d0efb59cc47b24af35471fe3bc8de3ccc05d --- dulwich/tests/test_bundle.py +++ dulwich/tests/test_bundle.py @@ -20,25 +20,15 @@ """Tests for bundle support.""" -from io import BytesIO import os import tempfile +from io import BytesIO -from dulwich.tests import ( - TestCase, -) +from dulwich.bundle import Bundle, read_bundle, write_bundle +from dulwich.pack import PackData, write_pack_objects +from dulwich.tests import TestCase -from dulwich.bundle import ( - Bundle, - read_bundle, - write_bundle, -) -from dulwich.pack import ( - PackData, - write_pack_objects, -) - class BundleTests(TestCase): def test_roundtrip_bundle(self): origbundle = Bundle() blob - 64fefbd8b59bd9330da1c9087e3d5f9d58b5a89d blob + 8ab424912994e7ed625fab216a1b937b93ec7afe --- dulwich/tests/test_client.py +++ dulwich/tests/test_client.py @@ -18,74 +18,37 @@ # License, Version 2.0. # -from io import BytesIO import base64 import os -import sys import shutil +import sys import tempfile import warnings - -from urllib.parse import ( - quote as urlquote, - urlparse, -) - +from io import BytesIO from unittest.mock import patch +from urllib.parse import quote as urlquote +from urllib.parse import urlparse import dulwich -from dulwich import ( - client, -) -from dulwich.client import ( - InvalidWants, - LocalGitClient, - TraditionalGitClient, - TCPGitClient, - SSHGitClient, - HttpGitClient, - FetchPackResult, - ReportStatusParser, - SendPackError, - StrangeHostname, - SubprocessSSHVendor, - PLinkSSHVendor, - HangupException, - GitProtocolError, - check_wants, - default_urllib3_manager, - get_credentials_from_store, - get_transport_and_path, - get_transport_and_path_from_url, - parse_rsync_url, - _remote_error_from_stderr, -) -from dulwich.config import ( - ConfigDict, -) -from dulwich.tests import ( - TestCase, -) -from dulwich.protocol import ( - TCP_GIT_PORT, - Protocol, -) -from dulwich.pack import ( - pack_objects_to_data, - write_pack_data, - write_pack_objects, -) +from dulwich import client +from dulwich.client import (FetchPackResult, GitProtocolError, HangupException, + HttpGitClient, InvalidWants, LocalGitClient, + PLinkSSHVendor, ReportStatusParser, SendPackError, + SSHGitClient, StrangeHostname, SubprocessSSHVendor, + TCPGitClient, TraditionalGitClient, + _remote_error_from_stderr, check_wants, + default_urllib3_manager, + get_credentials_from_store, get_transport_and_path, + get_transport_and_path_from_url, parse_rsync_url) +from dulwich.config import ConfigDict from dulwich.objects import Commit, Tree -from dulwich.repo import ( - MemoryRepo, - Repo, -) -from dulwich.tests import skipIf -from dulwich.tests.utils import ( - open_repo, - tear_down_repo, - setup_warning_catcher, -) +from dulwich.pack import (pack_objects_to_data, write_pack_data, + write_pack_objects) +from dulwich.protocol import TCP_GIT_PORT, Protocol +from dulwich.repo import MemoryRepo, Repo +from dulwich.tests import TestCase, skipIf +from dulwich.tests.utils import (open_repo, setup_warning_catcher, + tear_down_repo) class DummyClient(TraditionalGitClient): blob - dbdb6318239573ffb9b933f7002f1ada02a043ad blob + ed49f38c550a0fa56c1a52ce5df3013a24452ff0 --- dulwich/tests/test_config.py +++ dulwich/tests/test_config.py @@ -26,21 +26,11 @@ from io import BytesIO from unittest import skipIf from unittest.mock import patch -from dulwich.config import ( - ConfigDict, - ConfigFile, - StackedConfig, - _check_section_name, - _check_variable_name, - _format_string, - _escape_value, - _parse_string, - parse_submodules, - apply_instead_of, -) -from dulwich.tests import ( - TestCase, -) +from dulwich.config import (ConfigDict, ConfigFile, StackedConfig, + _check_section_name, _check_variable_name, + _escape_value, _format_string, _parse_string, + apply_instead_of, parse_submodules) +from dulwich.tests import TestCase class ConfigFileTests(TestCase): blob - 7bb90e56df3e207bf7337bb4133fc9c5506c9b48 blob + 046f46bd59ad5f5395e0632dab2d79e93d1f4abc --- dulwich/tests/test_credentials.py +++ dulwich/tests/test_credentials.py @@ -22,11 +22,8 @@ from urllib.parse import urlparse from dulwich.config import ConfigDict -from dulwich.credentials import ( - match_partial_url, - match_urls, - urlmatch_credential_sections, -) +from dulwich.credentials import (match_partial_url, match_urls, + urlmatch_credential_sections) from dulwich.tests import TestCase blob - 511554087060d18932e03ca20914e046ce340197 blob + 0be756f98a7c8036bb0c9038ec4d7ec726d137c3 --- dulwich/tests/test_diff_tree.py +++ dulwich/tests/test_diff_tree.py @@ -21,45 +21,19 @@ """Tests for file and tree diff utilities.""" from itertools import permutations -from dulwich.diff_tree import ( - CHANGE_MODIFY, - CHANGE_RENAME, - CHANGE_COPY, - CHANGE_UNCHANGED, - TreeChange, - _merge_entries, - _merge_entries_py, - tree_changes, - tree_changes_for_merge, - _count_blocks, - _count_blocks_py, - _similarity_score, - _tree_change_key, - RenameDetector, - _is_tree, - _is_tree_py, -) -from dulwich.index import ( - commit_tree, -) -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - ShaFile, - Blob, - TreeEntry, - Tree, -) -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.utils import ( - F, - make_object, - functest_builder, - ext_functest_builder, -) + +from dulwich.diff_tree import (CHANGE_COPY, CHANGE_MODIFY, CHANGE_RENAME, + CHANGE_UNCHANGED, RenameDetector, TreeChange, + _count_blocks, _count_blocks_py, _is_tree, + _is_tree_py, _merge_entries, _merge_entries_py, + _similarity_score, _tree_change_key, + tree_changes, tree_changes_for_merge) +from dulwich.index import commit_tree +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import Blob, ShaFile, Tree, TreeEntry +from dulwich.tests import TestCase +from dulwich.tests.utils import (F, ext_functest_builder, functest_builder, + make_object) class DiffTestCase(TestCase): blob - e3a26018557297ddfada8e6d196fe5640d71319f blob + 644ddd4acd75952e9691b97913d6eee09346fdc4 --- dulwich/tests/test_fastexport.py +++ dulwich/tests/test_fastexport.py @@ -18,29 +18,14 @@ # License, Version 2.0. # -from io import BytesIO import stat +from io import BytesIO - -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - Blob, - Commit, - Tree, - ZERO_SHA, -) -from dulwich.repo import ( - MemoryRepo, -) -from dulwich.tests import ( - SkipTest, - TestCase, -) -from dulwich.tests.utils import ( - build_commit_graph, -) +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import ZERO_SHA, Blob, Commit, Tree +from dulwich.repo import MemoryRepo +from dulwich.tests import SkipTest, TestCase +from dulwich.tests.utils import build_commit_graph class GitFastExporterTests(TestCase): blob - d1067d7ba53b4b2218acf34126ddf6bbe3869154 blob + cca943b4b001d5de7089e31f80dddaa012714b54 --- dulwich/tests/test_file.py +++ dulwich/tests/test_file.py @@ -25,10 +25,7 @@ import sys import tempfile from dulwich.file import FileLocked, GitFile, _fancy_rename -from dulwich.tests import ( - SkipTest, - TestCase, -) +from dulwich.tests import SkipTest, TestCase class FancyRenameTests(TestCase): blob - e367e7290d8d2cc0d2345abf3adb63badd69c4c6 blob + 4f30fe5a76873c591f7dc0e9930e28b2e652cbb6 --- dulwich/tests/test_grafts.py +++ dulwich/tests/test_grafts.py @@ -20,20 +20,14 @@ """Tests for graftpoints.""" import os -import tempfile import shutil +import tempfile from dulwich.errors import ObjectFormatException +from dulwich.objects import Tree +from dulwich.repo import (MemoryRepo, Repo, parse_graftpoints, + serialize_graftpoints) from dulwich.tests import TestCase -from dulwich.objects import ( - Tree, -) -from dulwich.repo import ( - parse_graftpoints, - serialize_graftpoints, - MemoryRepo, - Repo, -) def makesha(digit): blob - 3fb85ba737cea0c9dadd9fbe30fc2e9b052464f7 blob + d4be7f171be5e91716590b5ba60be62caba4906f --- dulwich/tests/test_graph.py +++ dulwich/tests/test_graph.py @@ -20,13 +20,12 @@ """Tests for dulwich.graph.""" +from dulwich.graph import _find_lcas, can_fast_forward +from dulwich.repo import MemoryRepo from dulwich.tests import TestCase from dulwich.tests.utils import make_commit -from dulwich.repo import MemoryRepo -from dulwich.graph import _find_lcas, can_fast_forward - class FindMergeBaseTests(TestCase): @staticmethod def run_test(dag, inputs): blob - 7f956d5785e08abe9fa3bf809e8a671d51bbe110 blob + 79cdc7bc76e4bcc0688878cb84ea83718eb6993c --- dulwich/tests/test_greenthreads.py +++ dulwich/tests/test_greenthreads.py @@ -22,19 +22,9 @@ import time -from dulwich.tests import ( - skipIf, - TestCase, -) -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - Commit, - Blob, - Tree, - parse_timezone, -) +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import Blob, Commit, Tree, parse_timezone +from dulwich.tests import TestCase, skipIf try: import gevent # noqa: F401 @@ -44,9 +34,7 @@ except ImportError: gevent_support = False if gevent_support: - from dulwich.greenthreads import ( - GreenThreadsMissingObjectFinder, - ) + from dulwich.greenthreads import GreenThreadsMissingObjectFinder skipmsg = "Gevent library is not installed" blob - f1a067b86b952c593193e1efe9a94329d2d81803 blob + ebd8098bedfb6bf5d8b7697efb7f2f3b46650ea5 --- dulwich/tests/test_hooks.py +++ dulwich/tests/test_hooks.py @@ -20,19 +20,14 @@ """Tests for executing hooks.""" import os -import stat import shutil +import stat import sys import tempfile from dulwich import errors - -from dulwich.hooks import ( - PreCommitShellHook, - PostCommitShellHook, - CommitMsgShellHook, -) - +from dulwich.hooks import (CommitMsgShellHook, PostCommitShellHook, + PreCommitShellHook) from dulwich.tests import TestCase blob - 3dbd0de9a5dfe5162ed4b00a1137bb208ee0eb66 blob + b7f1d38b8341204ea9c553f56e173b91ea668e57 --- dulwich/tests/test_ignore.py +++ dulwich/tests/test_ignore.py @@ -20,25 +20,18 @@ """Tests for ignore files.""" -from io import BytesIO import os import re import shutil import tempfile -from dulwich.tests import TestCase +from io import BytesIO -from dulwich.ignore import ( - IgnoreFilter, - IgnoreFilterManager, - IgnoreFilterStack, - Pattern, - match_pattern, - read_ignore_patterns, - translate, -) +from dulwich.ignore import (IgnoreFilter, IgnoreFilterManager, + IgnoreFilterStack, Pattern, match_pattern, + read_ignore_patterns, translate) from dulwich.repo import Repo +from dulwich.tests import TestCase - POSITIVE_MATCH_TESTS = [ (b"foo.c", b"*.c"), (b".c", b"*.c"), blob - 0031d58ff7a6e52c0987df395210d2312ad3ffbe blob + 0ff4d8b9053e368c3ab0c27726d6463542d6327a --- dulwich/tests/test_index.py +++ dulwich/tests/test_index.py @@ -22,46 +22,25 @@ """Tests for the index.""" -from io import BytesIO import os import shutil import stat import struct import sys import tempfile +from io import BytesIO -from dulwich.index import ( - Index, - build_index_from_tree, - cleanup_mode, - commit_tree, - get_unstaged_changes, - index_entry_from_stat, - read_index, - read_index_dict, - validate_path_element_default, - validate_path_element_ntfs, - write_cache_time, - write_index, - write_index_dict, - _tree_to_fs_path, - _fs_to_tree_path, - IndexEntry, -) -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - Blob, - Commit, - Tree, - S_IFGITLINK, -) +from dulwich.index import (Index, IndexEntry, _fs_to_tree_path, + _tree_to_fs_path, build_index_from_tree, + cleanup_mode, commit_tree, get_unstaged_changes, + index_entry_from_stat, read_index, read_index_dict, + validate_path_element_default, + validate_path_element_ntfs, write_cache_time, + write_index, write_index_dict) +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import S_IFGITLINK, Blob, Commit, Tree from dulwich.repo import Repo -from dulwich.tests import ( - TestCase, - skipIf, -) +from dulwich.tests import TestCase, skipIf def can_symlink(): blob - c7b3edf8e6b14d6065ba4d74aea3550efc5eb0f9 blob + f2720684651af0198131cab4fdccfb4dff6687c8 --- dulwich/tests/test_lfs.py +++ dulwich/tests/test_lfs.py @@ -20,12 +20,13 @@ """Tests for LFS support.""" -from . import TestCase -from ..lfs import LFSStore import shutil import tempfile +from ..lfs import LFSStore +from . import TestCase + class LFSTests(TestCase): def setUp(self): super().setUp() blob - b36236b46150cac7eb930005e2f762e400c1f550 blob + 6f54d4b3b749573716f33b550fe9620c71699bd7 --- dulwich/tests/test_line_ending.py +++ dulwich/tests/test_line_ending.py @@ -21,13 +21,9 @@ """Tests for the line ending conversion.""" -from dulwich.line_ending import ( - normalize_blob, - convert_crlf_to_lf, - convert_lf_to_crlf, - get_checkin_filter_autocrlf, - get_checkout_filter_autocrlf, -) +from dulwich.line_ending import (convert_crlf_to_lf, convert_lf_to_crlf, + get_checkin_filter_autocrlf, + get_checkout_filter_autocrlf, normalize_blob) from dulwich.objects import Blob from dulwich.tests import TestCase blob - 74fb848291178e8cd036b00e96506fdf46c6daf6 blob + 14551efcb9e260ef508ad524c96a7d58c0ee4458 --- dulwich/tests/test_lru_cache.py +++ dulwich/tests/test_lru_cache.py @@ -19,12 +19,8 @@ """Tests for the lru_cache module.""" -from dulwich import ( - lru_cache, -) -from dulwich.tests import ( - TestCase, -) +from dulwich import lru_cache +from dulwich.tests import TestCase class TestLRUCache(TestCase): blob - bd44689b4e6acf1f13af795e0a43402fa4b25a0e blob + 08a882a50924fa6180256562055ed5e6aa8a3e0a --- dulwich/tests/test_mailmap.py +++ dulwich/tests/test_mailmap.py @@ -21,7 +21,6 @@ """Tests for dulwich.mailmap.""" from io import BytesIO - from unittest import TestCase from dulwich.mailmap import Mailmap, read_mailmap blob - c971db37c0ed0e4c10d39a49a4baefac4c32fa9c blob + ba4eb76a37894f8aa0dd9f9bd43a9a674559814c --- dulwich/tests/test_missing_obj_finder.py +++ dulwich/tests/test_missing_obj_finder.py @@ -18,19 +18,10 @@ # License, Version 2.0. # -from dulwich.object_store import ( - MemoryObjectStore, - MissingObjectFinder, -) -from dulwich.objects import ( - Blob, -) +from dulwich.object_store import MemoryObjectStore, MissingObjectFinder +from dulwich.objects import Blob from dulwich.tests import TestCase -from dulwich.tests.utils import ( - make_object, - make_tag, - build_commit_graph, -) +from dulwich.tests.utils import build_commit_graph, make_object, make_tag class MissingObjectFinderTest(TestCase): blob - fc0abf09129ffe6ecae73a7bbfecbdf53d600cf7 blob + 7ab7fd99a5751f7906443603095cc3feb90ee6e4 --- dulwich/tests/test_object_store.py +++ dulwich/tests/test_object_store.py @@ -21,54 +21,27 @@ """Tests for the object store interface.""" -from contextlib import closing -from io import BytesIO -from unittest import skipUnless import os import shutil import stat import sys import tempfile +from contextlib import closing +from io import BytesIO +from unittest import skipUnless -from dulwich.index import ( - commit_tree, -) -from dulwich.errors import ( - NotTreeError, -) -from dulwich.objects import ( - sha_to_hex, - Blob, - Tree, - TreeEntry, - EmptyFileException, - SubmoduleEncountered, - S_IFGITLINK, -) -from dulwich.object_store import ( - DiskObjectStore, - MemoryObjectStore, - OverlayObjectStore, - ObjectStoreGraphWalker, - commit_tree_changes, - iter_tree_contents, - peel_sha, - read_packs_file, - tree_lookup_path, -) -from dulwich.pack import ( - REF_DELTA, - write_pack_objects, -) +from dulwich.errors import NotTreeError +from dulwich.index import commit_tree +from dulwich.object_store import (DiskObjectStore, MemoryObjectStore, + ObjectStoreGraphWalker, OverlayObjectStore, + commit_tree_changes, iter_tree_contents, + peel_sha, read_packs_file, tree_lookup_path) +from dulwich.objects import (S_IFGITLINK, Blob, EmptyFileException, + SubmoduleEncountered, Tree, TreeEntry, sha_to_hex) +from dulwich.pack import REF_DELTA, write_pack_objects from dulwich.protocol import DEPTH_INFINITE -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.utils import ( - make_object, - make_tag, - build_pack, -) +from dulwich.tests import TestCase +from dulwich.tests.utils import build_pack, make_object, make_tag try: from unittest.mock import patch blob - daf344f8f344d1fe3012a6f1c0042f898cdd7674 blob + 2da115eed6dae68005cfab67193f423407a680f4 --- dulwich/tests/test_objects.py +++ dulwich/tests/test_objects.py @@ -23,49 +23,24 @@ # TODO: Round-trip parse-serialize-parse and serialize-parse-serialize tests. -from io import BytesIO import datetime -from itertools import ( - permutations, -) import os import stat from contextlib import contextmanager +from io import BytesIO +from itertools import permutations -from dulwich.errors import ( - ObjectFormatException, -) -from dulwich.objects import ( - Blob, - Tree, - Commit, - ShaFile, - Tag, - TreeEntry, - format_timezone, - hex_to_sha, - sha_to_hex, - hex_to_filename, - check_hexsha, - check_identity, - object_class, - parse_timezone, - pretty_format_tree_entry, - parse_tree, - _parse_tree_py, - sorted_tree_items, - _sorted_tree_items_py, - MAX_TIME, -) -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.utils import ( - make_commit, - make_object, - functest_builder, - ext_functest_builder, -) +from dulwich.errors import ObjectFormatException +from dulwich.objects import (MAX_TIME, Blob, Commit, ShaFile, Tag, Tree, + TreeEntry, _parse_tree_py, _sorted_tree_items_py, + check_hexsha, check_identity, format_timezone, + hex_to_filename, hex_to_sha, object_class, + parse_timezone, parse_tree, + pretty_format_tree_entry, sha_to_hex, + sorted_tree_items) +from dulwich.tests import TestCase +from dulwich.tests.utils import (ext_functest_builder, functest_builder, + make_commit, make_object) a_sha = b"6f670c0fb53f9463760b7295fbb814e965fb20c8" b_sha = b"2969be3e8ee1c0222396a5611407e4769f14e54b" blob - 22340eb6cf86efc545ce1edbce9b3784d5f065e7 blob + cf539b33b480694d87a8f9cfa7b687345983bbb7 --- dulwich/tests/test_objectspec.py +++ dulwich/tests/test_objectspec.py @@ -23,26 +23,13 @@ # TODO: Round-trip parse-serialize-parse and serialize-parse-serialize tests. -from dulwich.objects import ( - Blob, -) -from dulwich.objectspec import ( - parse_object, - parse_commit, - parse_commit_range, - parse_ref, - parse_refs, - parse_reftuple, - parse_reftuples, - parse_tree, -) +from dulwich.objects import Blob +from dulwich.objectspec import (parse_commit, parse_commit_range, parse_object, + parse_ref, parse_refs, parse_reftuple, + parse_reftuples, parse_tree) from dulwich.repo import MemoryRepo -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.utils import ( - build_commit_graph, -) +from dulwich.tests import TestCase +from dulwich.tests.utils import build_commit_graph class ParseObjectTests(TestCase): blob - be3579e940386a0d850b3d544bde8672e03471df blob + 2e943609986c7ea6ebc3589588190336f10efdc4 --- dulwich/tests/test_pack.py +++ dulwich/tests/test_pack.py @@ -22,62 +22,28 @@ """Tests for Dulwich packs.""" -from io import BytesIO -from hashlib import sha1 import os import shutil import sys import tempfile import zlib +from hashlib import sha1 +from io import BytesIO -from dulwich.errors import ( - ApplyDeltaError, - ChecksumMismatch, -) -from dulwich.file import ( - GitFile, -) -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - hex_to_sha, - sha_to_hex, - Commit, - Tree, - Blob, -) -from dulwich.pack import ( - OFS_DELTA, - REF_DELTA, - MemoryPackIndex, - Pack, - PackData, - apply_delta, - create_delta, - deltify_pack_objects, - load_pack_index, - UnpackedObject, - read_zlib_chunks, - write_pack_header, - write_pack_index_v1, - write_pack_index_v2, - write_pack_object, - write_pack, - unpack_object, - compute_file_sha, - PackStreamReader, - DeltaChainIterator, - _delta_encode_size, - _encode_copy_operation, -) -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.utils import ( - make_object, - build_pack, -) +from dulwich.errors import ApplyDeltaError, ChecksumMismatch +from dulwich.file import GitFile +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import Blob, Commit, Tree, hex_to_sha, sha_to_hex +from dulwich.pack import (OFS_DELTA, REF_DELTA, DeltaChainIterator, + MemoryPackIndex, Pack, PackData, PackStreamReader, + UnpackedObject, _delta_encode_size, + _encode_copy_operation, apply_delta, + compute_file_sha, create_delta, deltify_pack_objects, + load_pack_index, read_zlib_chunks, unpack_object, + write_pack, write_pack_header, write_pack_index_v1, + write_pack_index_v2, write_pack_object) +from dulwich.tests import TestCase +from dulwich.tests.utils import build_pack, make_object pack1_sha = b"bc63ddad95e7321ee734ea11a7a62d314e0d7481" blob - 38aac88f64c2b9be1578d7f151269b1520b00bf1 blob + c202017fd341c228234bcc6f2a9e0373ccf081db --- dulwich/tests/test_patch.py +++ dulwich/tests/test_patch.py @@ -22,27 +22,12 @@ from io import BytesIO, StringIO -from dulwich.objects import ( - Blob, - Commit, - S_IFGITLINK, - Tree, -) -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.patch import ( - get_summary, - git_am_patch_split, - write_blob_diff, - write_commit_patch, - write_object_diff, - write_tree_diff, -) -from dulwich.tests import ( - SkipTest, - TestCase, -) +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import S_IFGITLINK, Blob, Commit, Tree +from dulwich.patch import (get_summary, git_am_patch_split, write_blob_diff, + write_commit_patch, write_object_diff, + write_tree_diff) +from dulwich.tests import SkipTest, TestCase class WriteCommitPatchTests(TestCase): blob - a4b65d6dc49a5a8876ffdfd0cea07636699eed24 blob + 155225cca3dfc6e6d95732ebc029bb15be86f7e9 --- dulwich/tests/test_porcelain.py +++ dulwich/tests/test_porcelain.py @@ -21,7 +21,6 @@ """Tests for dulwich.porcelain.""" import contextlib -from io import BytesIO, StringIO import os import platform import re @@ -33,38 +32,18 @@ import tarfile import tempfile import threading import time +from io import BytesIO, StringIO from unittest import skipIf from dulwich import porcelain from dulwich.diff_tree import tree_changes -from dulwich.errors import ( - CommitError, -) -from dulwich.objects import ( - Blob, - Tag, - Tree, - ZERO_SHA, -) -from dulwich.repo import ( - NoIndexPresent, - Repo, -) -from dulwich.server import ( - DictBackend, -) -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.utils import ( - build_commit_graph, - make_commit, - make_object, -) -from dulwich.web import ( - make_server, - make_wsgi_chain, -) +from dulwich.errors import CommitError +from dulwich.objects import ZERO_SHA, Blob, Tag, Tree +from dulwich.repo import NoIndexPresent, Repo +from dulwich.server import DictBackend +from dulwich.tests import TestCase +from dulwich.tests.utils import build_commit_graph, make_commit, make_object +from dulwich.web import make_server, make_wsgi_chain try: import gpg blob - 8875154dd0eeae61f8f57bf5b0842a69ae1a404c blob + 1ad66ff2449b1a87dc3f5f1f07bab5dabab95352 --- dulwich/tests/test_protocol.py +++ dulwich/tests/test_protocol.py @@ -23,22 +23,12 @@ from io import BytesIO -from dulwich.errors import ( - HangupException, -) -from dulwich.protocol import ( - GitProtocolError, - PktLineParser, - Protocol, - ReceivableProtocol, - extract_capabilities, - extract_want_line_capabilities, - ack_type, - SINGLE_ACK, - MULTI_ACK, - MULTI_ACK_DETAILED, - BufferedPktLineWriter, -) +from dulwich.errors import HangupException +from dulwich.protocol import (MULTI_ACK, MULTI_ACK_DETAILED, SINGLE_ACK, + BufferedPktLineWriter, GitProtocolError, + PktLineParser, Protocol, ReceivableProtocol, + ack_type, extract_capabilities, + extract_want_line_capabilities) from dulwich.tests import TestCase blob - 3c230950144b42b17a59680c3dfe80e47569fc19 blob + 973354cf0a3c7c74ca9b42afeff55dd342497fda --- dulwich/tests/test_reflog.py +++ dulwich/tests/test_reflog.py @@ -23,18 +23,11 @@ from io import BytesIO from dulwich.objects import ZERO_SHA -from dulwich.reflog import ( - drop_reflog_entry, - format_reflog_line, - parse_reflog_line, - read_reflog, -) +from dulwich.reflog import (drop_reflog_entry, format_reflog_line, + parse_reflog_line, read_reflog) +from dulwich.tests import TestCase -from dulwich.tests import ( - TestCase, -) - class ReflogLineTests(TestCase): def test_format(self): self.assertEqual( blob - 9dcb864d01fa60485f1f6a66112b22587946e5a0 blob + f318b38135a1e5eab0c3261a017a9dce6cbf2049 --- dulwich/tests/test_refs.py +++ dulwich/tests/test_refs.py @@ -20,39 +20,22 @@ """Tests for dulwich.refs.""" -from io import BytesIO import os import sys import tempfile +from io import BytesIO from dulwich import errors -from dulwich.file import ( - GitFile, -) +from dulwich.file import GitFile from dulwich.objects import ZERO_SHA -from dulwich.refs import ( - DictRefsContainer, - InfoRefsContainer, - SymrefLoop, - check_ref_format, - _split_ref_line, - parse_symref_value, - read_packed_refs_with_peeled, - read_packed_refs, - strip_peeled_refs, - write_packed_refs, -) +from dulwich.refs import (DictRefsContainer, InfoRefsContainer, SymrefLoop, + _split_ref_line, check_ref_format, + parse_symref_value, read_packed_refs, + read_packed_refs_with_peeled, strip_peeled_refs, + write_packed_refs) from dulwich.repo import Repo - -from dulwich.tests import ( - SkipTest, - TestCase, -) - -from dulwich.tests.utils import ( - open_repo, - tear_down_repo, -) +from dulwich.tests import SkipTest, TestCase +from dulwich.tests.utils import open_repo, tear_down_repo class CheckRefFormatTests(TestCase): blob - b3329800b233a7145bace72842dfe10f11995ffb blob + 7fa631a1860cb55b048412d26832e9334948f493 --- dulwich/tests/test_repository.py +++ dulwich/tests/test_repository.py @@ -29,31 +29,16 @@ import sys import tempfile import warnings -from dulwich import errors -from dulwich import porcelain -from dulwich.object_store import ( - tree_lookup_path, -) -from dulwich import objects +from dulwich import errors, objects, porcelain from dulwich.config import Config from dulwich.errors import NotGitRepository -from dulwich.repo import ( - InvalidUserIdentity, - Repo, - MemoryRepo, - check_user_identity, - UnsupportedVersion, - UnsupportedExtension, -) -from dulwich.tests import ( - TestCase, - skipIf, -) -from dulwich.tests.utils import ( - open_repo, - tear_down_repo, - setup_warning_catcher, -) +from dulwich.object_store import tree_lookup_path +from dulwich.repo import (InvalidUserIdentity, MemoryRepo, Repo, + UnsupportedExtension, UnsupportedVersion, + check_user_identity) +from dulwich.tests import TestCase, skipIf +from dulwich.tests.utils import (open_repo, setup_warning_catcher, + tear_down_repo) missing_sha = b"b91fa4d900e17e99b433218e988c4eb4a3e9a097" blob - 29802c6ae8956a97aa3b16e691df9d0d8edc4eaf blob + c5404d0096e1301d679dcf724c5f1854af0e3900 --- dulwich/tests/test_server.py +++ dulwich/tests/test_server.py @@ -20,52 +20,27 @@ """Tests for the smart protocol server.""" -from io import BytesIO import os import shutil +import sys import tempfile +from io import BytesIO -import sys - -from dulwich.errors import ( - GitProtocolError, - NotGitRepository, - UnexpectedCommandError, - HangupException, -) +from dulwich.errors import (GitProtocolError, HangupException, + NotGitRepository, UnexpectedCommandError) +from dulwich.object_store import MemoryObjectStore from dulwich.objects import Tree -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.repo import ( - MemoryRepo, - Repo, -) -from dulwich.server import ( - Backend, - DictBackend, - FileSystemBackend, - MultiAckGraphWalkerImpl, - MultiAckDetailedGraphWalkerImpl, - PackHandler, - _split_proto_line, - serve_command, - _find_shallow, - _ProtocolGraphWalker, - ReceivePackHandler, - SingleAckGraphWalkerImpl, - UploadPackHandler, - update_server_info, -) +from dulwich.protocol import ZERO_SHA, format_capability_line +from dulwich.repo import MemoryRepo, Repo +from dulwich.server import (Backend, DictBackend, FileSystemBackend, + MultiAckDetailedGraphWalkerImpl, + MultiAckGraphWalkerImpl, PackHandler, + ReceivePackHandler, SingleAckGraphWalkerImpl, + UploadPackHandler, _find_shallow, + _ProtocolGraphWalker, _split_proto_line, + serve_command, update_server_info) from dulwich.tests import TestCase -from dulwich.tests.utils import ( - make_commit, - make_tag, -) -from dulwich.protocol import ( - ZERO_SHA, - format_capability_line, -) +from dulwich.tests.utils import make_commit, make_tag ONE = b"1" * 40 TWO = b"2" * 40 blob - ff16dd52d5e857f566768d68d5917c56ca2bb551 blob + d1e18db22b9445502cc682d3b4734d930069d27f --- dulwich/tests/test_stash.py +++ dulwich/tests/test_stash.py @@ -20,10 +20,9 @@ """Tests for stashes.""" -from . import TestCase - from ..repo import MemoryRepo from ..stash import Stash +from . import TestCase class StashTests(TestCase): blob - be234c15da49064582c70a29ce2b775d995adecc blob + c95d335892ac7d9674d60cb6f6dc4a7be5402749 --- dulwich/tests/test_utils.py +++ dulwich/tests/test_utils.py @@ -20,19 +20,10 @@ """Tests for git test utilities.""" -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - Blob, -) -from dulwich.tests import ( - TestCase, -) -from dulwich.tests.utils import ( - make_object, - build_commit_graph, -) +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import Blob +from dulwich.tests import TestCase +from dulwich.tests.utils import build_commit_graph, make_object class BuildCommitGraphTest(TestCase): blob - 30ee3d02236637982d088d02411c308e2d26a996 blob + 9e1922fa22ef432a1f698ef14b478bddc515d2bf --- dulwich/tests/test_walk.py +++ dulwich/tests/test_walk.py @@ -20,35 +20,17 @@ """Tests for commit walking functionality.""" -from itertools import ( - permutations, -) +from itertools import permutations from unittest import expectedFailure -from dulwich.diff_tree import ( - CHANGE_MODIFY, - CHANGE_RENAME, - TreeChange, - RenameDetector, -) -from dulwich.errors import ( - MissingCommitError, -) -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - Commit, - Blob, -) -from dulwich.walk import ORDER_TOPO, WalkEntry, Walker, _topo_reorder +from dulwich.diff_tree import (CHANGE_MODIFY, CHANGE_RENAME, RenameDetector, + TreeChange) +from dulwich.errors import MissingCommitError +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import Blob, Commit from dulwich.tests import TestCase -from dulwich.tests.utils import ( - F, - make_object, - make_tag, - build_commit_graph, -) +from dulwich.tests.utils import F, build_commit_graph, make_object, make_tag +from dulwich.walk import ORDER_TOPO, WalkEntry, Walker, _topo_reorder class TestWalkEntry: blob - cf395d1304c426089959aac005ffb07bdfebac5b blob + f4ff269b06475b41ae5d4a23182516ab5f16e891 --- dulwich/tests/test_web.py +++ dulwich/tests/test_web.py @@ -20,51 +20,23 @@ """Tests for the Git HTTP server.""" -from io import BytesIO import gzip -import re import os +import re +from io import BytesIO from typing import Type -from dulwich.object_store import ( - MemoryObjectStore, -) -from dulwich.objects import ( - Blob, -) -from dulwich.repo import ( - BaseRepo, - MemoryRepo, -) -from dulwich.server import ( - DictBackend, -) -from dulwich.tests import ( - TestCase, -) -from dulwich.web import ( - HTTP_OK, - HTTP_NOT_FOUND, - HTTP_FORBIDDEN, - HTTP_ERROR, - GunzipFilter, - send_file, - get_text_file, - get_loose_object, - get_pack_file, - get_idx_file, - get_info_refs, - get_info_packs, - handle_service_request, - _LengthLimitedFile, - HTTPGitRequest, - HTTPGitApplication, -) - -from dulwich.tests.utils import ( - make_object, - make_tag, -) +from dulwich.object_store import MemoryObjectStore +from dulwich.objects import Blob +from dulwich.repo import BaseRepo, MemoryRepo +from dulwich.server import DictBackend +from dulwich.tests import TestCase +from dulwich.tests.utils import make_object, make_tag +from dulwich.web import (HTTP_ERROR, HTTP_FORBIDDEN, HTTP_NOT_FOUND, HTTP_OK, + GunzipFilter, HTTPGitApplication, HTTPGitRequest, + _LengthLimitedFile, get_idx_file, get_info_packs, + get_info_refs, get_loose_object, get_pack_file, + get_text_file, handle_service_request, send_file) class MinimalistWSGIInputStream: blob - 110046c8c8dca427685014c0548b359c7e2e0109 blob + c7a8897a6b0d27993228280a07bf9b7b5fb44171 --- dulwich/tests/utils.py +++ dulwich/tests/utils.py @@ -27,34 +27,15 @@ import shutil import tempfile import time import types - import warnings -from dulwich.index import ( - commit_tree, -) -from dulwich.objects import ( - FixedSha, - Commit, - Tag, - object_class, -) -from dulwich.pack import ( - OFS_DELTA, - REF_DELTA, - DELTA_TYPES, - obj_sha, - SHA1Writer, - write_pack_header, - write_pack_object, - create_delta, -) +from dulwich.index import commit_tree +from dulwich.objects import Commit, FixedSha, Tag, object_class +from dulwich.pack import (DELTA_TYPES, OFS_DELTA, REF_DELTA, SHA1Writer, + create_delta, obj_sha, write_pack_header, + write_pack_object) from dulwich.repo import Repo -from dulwich.tests import ( # noqa: F401 - skipIf, - SkipTest, -) - +from dulwich.tests import SkipTest, skipIf # noqa: F401 # Plain files are very frequently used in tests, so let the mode be very short. F = 0o100644 # Shorthand mode for Files. blob - 7c72cc5921d925602cf52e7d75fd331cd1239e51 blob + dbbbb938837b1ecf3b516b6e2cc1e4c910e9bf5a --- dulwich/walk.py +++ dulwich/walk.py @@ -24,22 +24,12 @@ import collections import heapq from itertools import chain -from typing import List, Tuple, Set, Deque, Optional +from typing import Deque, List, Optional, Set, Tuple -from dulwich.diff_tree import ( - RENAME_CHANGE_TYPES, - tree_changes, - tree_changes_for_merge, - RenameDetector, -) -from dulwich.errors import ( - MissingCommitError, -) -from dulwich.objects import ( - Commit, - Tag, - ObjectID, -) +from dulwich.diff_tree import (RENAME_CHANGE_TYPES, RenameDetector, + tree_changes, tree_changes_for_merge) +from dulwich.errors import MissingCommitError +from dulwich.objects import Commit, ObjectID, Tag ORDER_DATE = "date" ORDER_TOPO = "topo" blob - e6767dfd8eb94540be263836781e96b46b721a1e blob + 604450728c81d24a70d9575288508e937ad6c104 --- dulwich/web.py +++ dulwich/web.py @@ -21,38 +21,21 @@ """HTTP server for dulwich that implements the git smart HTTP protocol.""" -from io import BytesIO import os import re import sys import time -from typing import List, Tuple, Optional -from wsgiref.simple_server import ( - WSGIRequestHandler, - ServerHandler, - WSGIServer, - make_server, -) - +from io import BytesIO +from typing import List, Optional, Tuple from urllib.parse import parse_qs +from wsgiref.simple_server import (ServerHandler, WSGIRequestHandler, + WSGIServer, make_server) - from dulwich import log_utils -from dulwich.protocol import ( - ReceivableProtocol, -) -from dulwich.repo import ( - BaseRepo, - NotGitRepository, - Repo, -) -from dulwich.server import ( - DictBackend, - DEFAULT_HANDLERS, - generate_info_refs, - generate_objects_info_packs, -) - +from dulwich.protocol import ReceivableProtocol +from dulwich.repo import BaseRepo, NotGitRepository, Repo +from dulwich.server import (DEFAULT_HANDLERS, DictBackend, generate_info_refs, + generate_objects_info_packs) logger = log_utils.getLogger(__name__) blob - 7dd2381cad00493199e748fe8d648cc224bfd064 blob + d51c2fc077449302749e489602172a5e15661934 --- examples/clone.py +++ examples/clone.py @@ -10,14 +10,11 @@ Example usage: import sys - +from getopt import getopt from os.path import basename -from getopt import getopt - from dulwich import porcelain - _, args = getopt(sys.argv, "", []) blob - fabcd6215c6fa310dd936785b59fa8d40cd52696 blob + a074e1b958b0ce7a920c531cca45ac3dd6c441f0 --- examples/diff.py +++ examples/diff.py @@ -5,10 +5,11 @@ # Example usage: # python examples/diff.py -from dulwich.repo import Repo -from dulwich.patch import write_tree_diff import sys +from dulwich.patch import write_tree_diff +from dulwich.repo import Repo + repo_path = "." commit_id = b"a6602654997420bcfd0bee2a0563d9416afe34b4" blob - aae42bffcff71092d0c1ed0978ce7c4a315cbc8b blob + 26c3d2104cfa1ec34357b8c6d62e0299a81215ec --- examples/gcs.py +++ examples/gcs.py @@ -1,12 +1,12 @@ #!/usr/bin/python3 -from dulwich.repo import Repo -from dulwich.cloud.gcs import GcsObjectStore - import tempfile from google.cloud import storage +from dulwich.cloud.gcs import GcsObjectStore +from dulwich.repo import Repo + client = storage.Client() bucket = client.get_bucket('mybucket') blob - 14b158f2c202736fb013b801c0617f3afc935952 blob + 1a4229b8dc61557e7a735c2ab0f4ddcbc0a18add --- examples/latest_change.py +++ examples/latest_change.py @@ -3,6 +3,7 @@ import sys import time + from dulwich.repo import Repo if len(sys.argv) < 2: blob - e023b0736e45d0cf0b94ac01d31ef744cc8fc4f4 blob + 23118f555f21178498282b69473d101050399966 --- examples/rename-branch.py +++ examples/rename-branch.py @@ -1,10 +1,11 @@ #!/usr/bin/python3 +import argparse + from dulwich.client import get_transport_and_path_from_url from dulwich.objects import ZERO_SHA from dulwich.pack import pack_objects_to_data -import argparse parser = argparse.ArgumentParser() parser.add_argument('url', type=str) parser.add_argument('old_ref', type=str) blob - 46b0745c556c34cfbbdc3cacb2bed08c00e402d0 blob + 4a758542ab576526de415748b88e01bbddebbfd0 --- setup.py +++ setup.py @@ -2,10 +2,10 @@ # Setup file for dulwich # Copyright (C) 2008-2022 Jelmer Vernooij -from setuptools import setup, Extension import os import sys +from setuptools import Extension, setup if sys.version_info < (3, 6): raise Exception(