commit - 2ea06096079b0d6641dc41e5c598fb835607e54e
commit + 260a6d9c91b5d530b912e4046b84c039a685fb5b
blob - 026fdca3d5fc6d3c592623312d18bb7ee5e29c78
blob + 91159b95a15c816fe9543a63c1ddb9cd7f9098de
--- dulwich/refs.py
+++ dulwich/refs.py
valid_hexsha,
ZERO_SHA,
Tag,
+ ObjectID,
)
from dulwich.file import (
GitFile,
ensure_dir_exists,
)
+Ref = bytes
HEADREF = b"HEAD"
SYMREF = b"ref: "
raise ValueError(contents)
-def check_ref_format(refname):
+def check_ref_format(refname: Ref):
"""Check if a refname is correctly formatted.
Implements all the same rules as git-check-ref-format[1].
def import_refs(
self,
- base: bytes,
- other: Dict[bytes, bytes],
+ base: Ref,
+ other: Dict[Ref, ObjectID],
committer: Optional[bytes] = None,
timestamp: Optional[bytes] = None,
timezone: Optional[bytes] = None,
def set_symbolic_ref(
self,
- name,
- other,
+ name: Ref,
+ other: Ref,
committer=None,
timestamp=None,
timezone=None,
def add_if_new(
self,
- name: bytes,
- ref: bytes,
+ name: Ref,
+ ref: ObjectID,
committer=None,
timestamp=None,
timezone=None,
blob - 0fa4b1fd483b2f59fa583f53a414f04a50323967
blob + 89439b4b22e7fee40a30893f00779eca2eb6a6db
--- dulwich/repo.py
+++ dulwich/repo.py
return cached
return self.object_store.peel_sha(self.refs[ref]).id
- def get_walker(self, include=None, *args, **kwargs):
+ def get_walker(self, include: Optional[List[bytes]] = None,
+ *args, **kwargs):
"""Obtain a walker for this repository.
Args:
if include is None:
include = [self.head()]
- if isinstance(include, str):
- include = [include]
kwargs["get_parents"] = lambda commit: self.get_parents(commit.id, commit)