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:
BaseCommand
Land 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.
--local
option can be used to skip the patching step.- needs_api: bool = True[source]¶
Whether the command needs the API client.
If this is set, the initialization of the command will set
api_client
andapi_root
.New in version 3.0.
- Type:
- needs_scm_client: bool = True[source]¶
Whether the command needs the SCM client.
If this is set, the initialization of the command will set
repository_info
andtool
.New in version 3.0.
- Type:
- needs_repository: 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_api
andneeds_scm_client
toTrue
.New in version 3.0.
- Type:
- args: 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:
- option_list: List[Union[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:
list
ofOption
orOptionGroup
- patch(review_request_id, squash=False)[source]¶
Patch a single review request’s diff using rbt patch.
- can_land(review_request)[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 None if it can be landed.
- land(destination_branch, review_request, source_branch=None, squash=False, edit=False, delete_branch=True, dry_run=False)[source]¶
Land an individual review request.
- Parameters:
destination_branch (
unicode
) – The destination branch that the change will be committed or merged to.review_request (
rbtools.api.resource.ReviewRequestResource
) – The review request containing the change to land.source_branch (
unicode
, 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.
- initialize()[source]¶
Initialize the command.
This overrides
BaseCommand.initialize
in 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.