diff options
author | Yobmod <yobmod@gmail.com> | 2021-06-30 18:41:06 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-06-30 18:41:06 +0100 |
commit | 82b131cf2afebbed3723df5b5dfd5cd820716f97 (patch) | |
tree | ef007c76db64b1f0cbfc99941a9a4de7d3fd3b8a /git/remote.py | |
parent | 75dbf90efb5e292bac5f54700f7f0efedf3e47d5 (diff) | |
download | gitpython-82b131cf2afebbed3723df5b5dfd5cd820716f97.tar.gz |
Type Traversable.traverse() better, start types of submodule
Diffstat (limited to 'git/remote.py')
-rw-r--r-- | git/remote.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/git/remote.py b/git/remote.py index a6232db3..a036446e 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', '?'] @@ -154,7 +152,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 @@ -284,7 +282,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 +302,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 +347,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 |