diff options
author | Sjoerd Langkemper <sjoerd-github@linuxonly.nl> | 2021-11-10 12:40:06 +0000 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-11-13 15:20:20 +0800 |
commit | 35f7e9486c8bc596506a6872c7e0df37c4a35da3 (patch) | |
tree | 22e3edd3bf6c18e3680bcffb747069ab4e976210 | |
parent | e67e458ece9077f6c6db9fc6a867ac61e0ae6579 (diff) | |
download | gitpython-35f7e9486c8bc596506a6872c7e0df37c4a35da3.tar.gz |
Extend IterableList[PushInfo] instead of IterableList
-rw-r--r-- | git/remote.py | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/git/remote.py b/git/remote.py index c212f6d2..7d5918a5 100644 --- a/git/remote.py +++ b/git/remote.py @@ -116,23 +116,6 @@ def to_progress_instance(progress: Union[Callable[..., Any], RemoteProgress, Non return progress -class PushInfoList(IterableList): - def __new__(cls) -> 'PushInfoList': - base = super().__new__(cls, 'push_infos') - return cast(PushInfoList, base) - - def __init__(self) -> None: - super().__init__('push_infos') - self.error: Optional[Exception] = None - - def raise_if_error(self) -> None: - """ - Raise an exception if any ref failed to push. - """ - if self.error: - raise self.error - - class PushInfo(IterableObj, object): """ Carries information about the result of a push operation of a single head:: @@ -252,6 +235,22 @@ class PushInfo(IterableObj, object): raise NotImplementedError +class PushInfoList(IterableList[PushInfo]): + def __new__(cls) -> 'PushInfoList': + return cast(PushInfoList, IterableList.__new__(cls, 'push_infos')) + + def __init__(self) -> None: + super().__init__('push_infos') + self.error: Optional[Exception] = None + + def raise_if_error(self) -> None: + """ + Raise an exception if any ref failed to push. + """ + if self.error: + raise self.error + + class FetchInfo(IterableObj, object): """ |