Skip to content

Document PushInfoList #1522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions git/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ def iter_items(cls, repo: "Repo", *args: Any, **kwargs: Any) -> NoReturn: # ->


class PushInfoList(IterableList[PushInfo]):
"""
IterableList of PushInfo objects.
"""

def __new__(cls) -> "PushInfoList":
return cast(PushInfoList, IterableList.__new__(cls, "push_infos"))

Expand Down Expand Up @@ -1004,7 +1008,7 @@ def push(
progress: Union[RemoteProgress, "UpdateProgress", Callable[..., RemoteProgress], None] = None,
kill_after_timeout: Union[None, float] = None,
**kwargs: Any,
) -> IterableList[PushInfo]:
) -> PushInfoList:
"""Push changes from source branch in refspec to target branch in refspec.

:param refspec: see 'fetch' method
Expand All @@ -1025,13 +1029,13 @@ def push(
should be killed. It is set to None by default.
:param kwargs: Additional arguments to be passed to git-push
:return:
list(PushInfo, ...) list of PushInfo instances, each
one informing about an individual head which had been updated on the remote
side.
A ``PushInfoList`` object, where each list member
represents an individual head which had been updated on the remote side.
If the push contains rejected heads, these will have the PushInfo.ERROR bit set
in their flags.
If the operation fails completely, the length of the returned IterableList will
be 0."""
If the operation fails completely, the length of the returned PushInfoList will
be 0.
Call ``.raise_if_error()`` on the returned object to raise on any failure."""
kwargs = add_progress(kwargs, self.repo.git, progress)
proc = self.repo.git.push(
"--",
Expand Down