rbtools.commands.land¶
Implementation of rbt land.
Classes
|
Land changes from a review request onto the remote repository. |
- class rbtools.commands.land.Land(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:
BaseCommandLand changes from a review request onto the remote repository.
This command takes a review request, applies it to a feature branch, merges it with the specified destination branch, and pushes the changes to an upstream repository.
Notes
The review request needs to be approved first.
--localoption can be used to skip the patching step.- __firstlineno__ = 28¶
- __static_attributes__ = ('cmd_args',)¶
- args: ClassVar[str] = '[<branch-name>]'[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:
- can_land(review_request: ReviewRequestItemResource) str | None[source]¶
Determine if the review request is land-able.
A review request can be landed if it is approved or, if the Review Board server does not keep track of approval, if the review request has a ship-it count.
This function returns the error with landing the review request or
Noneif it can be landed.- Parameters:
review_request (
rbtools.api.resource.ReviewRequestItemResource) – The review request containing the change to land.
- 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 review request ID 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.
- land(destination_branch: str, review_request: ReviewRequestItemResource, source_branch: str | None = None, squash: bool = False, edit: bool = False, delete_branch: bool = True, dry_run: bool = False) None[source]¶
Land an individual review request.
- Parameters:
destination_branch (
str) – The destination branch that the change will be committed or merged to.review_request (
rbtools.api.resource.ReviewRequestItemResource) – The review request containing the change to land.source_branch (
str, optional) – The source branch to land, if landing from a local branch.squash (
bool, optional) – Whether to squash the changes on the branch, for repositories that support it.edit (
bool, optional) – Whether to edit the commit message before landing.delete_branch (
bool, optional) – Whether to delete/close the branch, if landing from a local branch.dry_run (
bool, optional) – Whether to simulate landing without actually changing the repository.
- main(branch_name: str | None = None, *args) int[source]¶
Run the command.
- Parameters:
branch_name (
str, optional) – The branch name to land the change on.
- 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_repository: ClassVar[bool] = True[source]¶
Whether the command needs the remote repository object.
If this is set, the initialization of the command will set
repository.Setting this will imply setting both
needs_apiandneeds_scm_clienttoTrue.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.Option object>, <rbtools.commands.base.options.Option object>, <rbtools.commands.base.options.OptionGroup object>, <rbtools.commands.base.options.OptionGroup object>, <rbtools.commands.base.options.OptionGroup object>][source]¶
Command-line options for this command.
- Type:
listofOptionorOptionGroup