diff options
Diffstat (limited to 'git/remote.py')
-rw-r--r-- | git/remote.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/git/remote.py b/git/remote.py index a6232db3..0ef54ea7 100644 --- a/git/remote.py +++ b/git/remote.py @@ -38,14 +38,12 @@ from .refs import ( from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, TYPE_CHECKING, Union, overload -from git.types import PathLike, Literal, TBD, TypeGuard +from git.types import PathLike, Literal, TBD, TypeGuard, Commit_ish if TYPE_CHECKING: from git.repo.base import Repo - from git.objects.commit import Commit - from git.objects.blob import Blob - from git.objects.tree import Tree - from git.objects.tag import TagObject + # from git.objects.commit import Commit + # from git.objects import Blob, Tree, TagObject flagKeyLiteral = Literal[' ', '!', '+', '-', '*', '=', 't', '?'] @@ -130,6 +128,7 @@ class PushInfo(IterableObj, object): info.summary # summary line providing human readable english text about the push """ __slots__ = ('local_ref', 'remote_ref_string', 'flags', '_old_commit_sha', '_remote', 'summary') + _id_attribute_ = 'pushinfo' NEW_TAG, NEW_HEAD, NO_MATCH, REJECTED, REMOTE_REJECTED, REMOTE_FAILURE, DELETED, \ FORCED_UPDATE, FAST_FORWARD, UP_TO_DATE, ERROR = [1 << x for x in range(11)] @@ -154,7 +153,7 @@ class PushInfo(IterableObj, object): self.summary = summary @property - def old_commit(self) -> Union[str, SymbolicReference, 'Commit', 'TagObject', 'Blob', 'Tree', None]: + def old_commit(self) -> Union[str, SymbolicReference, 'Commit_ish', None]: return self._old_commit_sha and self._remote.repo.commit(self._old_commit_sha) or None @property @@ -244,6 +243,7 @@ class FetchInfo(IterableObj, object): info.remote_ref_path # The path from which we fetched on the remote. It's the remote's version of our info.ref """ __slots__ = ('ref', 'old_commit', 'flags', 'note', 'remote_ref_path') + _id_attribute_ = 'fetchinfo' NEW_TAG, NEW_HEAD, HEAD_UPTODATE, TAG_UPDATE, REJECTED, FORCED_UPDATE, \ FAST_FORWARD, ERROR = [1 << x for x in range(8)] @@ -284,7 +284,7 @@ class FetchInfo(IterableObj, object): return True def __init__(self, ref: SymbolicReference, flags: int, note: str = '', - old_commit: Union['Commit', TagReference, 'Tree', 'Blob', None] = None, + old_commit: Union[Commit_ish, None] = None, remote_ref_path: Optional[PathLike] = None) -> None: """ Initialize a new instance @@ -304,7 +304,7 @@ class FetchInfo(IterableObj, object): return self.ref.name @property - def commit(self) -> 'Commit': + def commit(self) -> Commit_ish: """:return: Commit of our remote ref""" return self.ref.commit @@ -349,7 +349,7 @@ class FetchInfo(IterableObj, object): # END control char exception handling # parse operation string for more info - makes no sense for symbolic refs, but we parse it anyway - old_commit = None # type: Union[Commit, TagReference, Tree, Blob, None] + old_commit = None # type: Union[Commit_ish, None] is_tag_operation = False if 'rejected' in operation: flags |= cls.REJECTED |