rbtools.commands.patch¶
Implementation of rbt patch.
Classes
|
Applies a specific patch from a RB server. |
Information on a pending patch to apply. |
- class rbtools.commands.patch.PatchCommand(transport_cls: type[Transport] = <class 'rbtools.api.transport.sync.SyncTransport'>, stdout: TextIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, stderr: TextIO = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, stdin: TextIO = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>)[source]¶
Bases:
BaseCommandApplies a specific patch from a RB server.
The patch file indicated by the request id is downloaded from the server and then applied locally.
- __firstlineno__ = 52¶
- __static_attributes__ = ('_review_request_id', 'needs_repository', 'needs_scm_client')¶
- args: ClassVar[str] = '<review-request-id>'[source]¶
Usage text for what arguments the command takes.
Arguments for the command are anything passed in other than defined options (for example, revisions passed to rbt post).
- Type:
- get_patches(*, diff_revision: int | None = None, commit_ids: set[str] | None = None, squashed: bool = False, reverted: bool = False, include_binary: bool = True) Sequence[PendingPatchInfo][source]¶
Return the requested patches and their metadata.
If a diff revision is not specified, then this will look at the most recent diff.
- Parameters:
diff_revision (
int, optional) –The diff revision to apply.
The latest revision will be used if not provided.
commit_ids (
listofstr, optional) –The specific commit IDs to apply.
If not specified, the squashed version of any commits (or the sole diff, in a non-multi-commit review request) will be applied.
squashed (
bool, optional) – Whether to return a squashed version of the commits, if using a multi-commit review request.reverted (
bool, optional) – Return patches in the order needed to revert them.include_binary (
bool, optional) –Whether to include binary files in the patches.
Added in version 6.0.
- Returns:
A list of dictionaries with patch information.
- Return type:
- Raises:
rbtools.command.CommandError – One of the following occurred: * The patch could not be retrieved or does not exist * The review request was created without history support and
commit_idswas provided. * One or more requested commit IDs could not be found.
- initialize() None[source]¶
Initialize the command.
This overrides
BaseCommand.initializein order to handle full review request URLs on the command line. In this case, we want to parse that URL in order to pull the server name and diff revision out of it.- Raises:
rbtools.commands.CommandError – A review request URL passed in as the review request ID could not be parsed correctly or included a bad diff revision.
- needs_api: ClassVar[bool] = True[source]¶
Whether the command needs the API client.
If this is set, the initialization of the command will set
api_clientandapi_root.Added in version 3.0.
- Type:
- needs_scm_client: ClassVar[bool] = True[source]¶
Whether the command needs the SCM client.
If this is set, the initialization of the command will set
repository_infoandtool.Added in version 3.0.
- Type:
- option_list: ClassVar[list[Option | OptionGroup]] = [<rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.OptionGroup object>, <rbtools.commands.base.options.OptionGroup object>][source]¶
Command-line options for this command.
- Type:
listofOptionorOptionGroup
- class rbtools.commands.patch.PendingPatchInfo[source]¶
Bases:
TypedDictInformation on a pending patch to apply.
Added in version 5.1.
- __firstlineno__ = 33¶
- __static_attributes__ = ()¶