class documentation

Protocol handler for downloading a pack from the client.

Method __init__ Initialize receive-pack handler.
Method capabilities Return supported capabilities.
Method handle Handle receive-pack request.
Instance Variable advertise_refs Undocumented
Instance Variable repo Undocumented
Method _apply_pack Apply received pack to repository.
Method _on_post_receive Run post-receive hook.
Method _on_pre_receive Run pre-receive hook.
Method _on_update Run update hook for a single ref.
Method _report_status Report status to client.

Inherited from PackHandler:

Class Method innocuous_capabilities Return capabilities that don't affect protocol behavior.
Class Method required_capabilities Return a list of capabilities that we require the client to have.
Method has_capability Check if the client supports a specific capability.
Method notify_done Notify that the 'done' command has been received from the client.
Method set_client_capabilities Set the client capabilities and validate them.
Instance Variable _client_capabilities Undocumented
Instance Variable _done_received Undocumented

Inherited from Handler (via PackHandler):

Instance Variable backend Undocumented
Instance Variable proto Undocumented
Instance Variable stateless_rpc Undocumented
def __init__(self, backend: Backend, args: Sequence[str], proto: Protocol, stateless_rpc: bool = False, advertise_refs: bool = False):

Initialize receive-pack handler.

Parameters
backend:BackendBackend instance
args:Sequence[str]Command arguments
proto:ProtocolProtocol instance
stateless_rpc:boolWhether to use stateless RPC
advertise_refs:boolWhether to advertise refs
def capabilities(self) -> Iterable[bytes]:

Return supported capabilities.

Returns
Iterable[bytes]List of capability names including object-format for the repository
def handle(self):

Handle receive-pack request.

advertise_refs =
repo =

Undocumented

def _apply_pack(self, refs: list[tuple[ObjectID, ObjectID, Ref]]) -> Iterator[tuple[bytes, bytes]]:

Apply received pack to repository.

Parameters
refs:list[tuple[ObjectID, ObjectID, Ref]]List of (old_sha, new_sha, ref_name) tuples
Returns
Iterator[tuple[bytes, bytes]]Undocumented
Yields
Tuples of (ref_name, error_message) for any errors
def _on_post_receive(self, client_refs: dict[bytes, tuple[bytes, bytes]]):

Run post-receive hook.

Parameters
client_refs:dict[bytes, tuple[bytes, bytes]]Dictionary of ref changes from client
def _on_pre_receive(self, client_refs: list[tuple[ObjectID, ObjectID, Ref]]):

Run pre-receive hook.

Parameters
client_refs:list[tuple[ObjectID, ObjectID, Ref]]List of (old_sha, new_sha, ref_name) tuples
Raises
HookErrorIf hook fails, preventing the push
def _on_update(self, ref_name: Ref, old_sha: ObjectID, new_sha: ObjectID) -> bytes | None:

Run update hook for a single ref.

Parameters
ref_name:RefName of the reference
old_sha:ObjectIDOld SHA of the reference
new_sha:ObjectIDNew SHA of the reference
Returns
bytes | NoneError message if hook fails, None otherwise
def _report_status(self, status: Sequence[tuple[bytes, bytes]]):

Report status to client.

Parameters
status:Sequence[tuple[bytes, bytes]]List of (ref_name, status_message) tuples