gerrit.changes package
Submodules
gerrit.changes.change module
- class gerrit.changes.change.GerritChange(id: str, gerrit)[source]
Bases:
GerritBase
- abandon()[source]
Abandons a change. Abandoning a change also removes all users from the attention set. If the change cannot be abandoned because the change state doesn’t allow abandoning of the change, the response is “409 Conflict” and the error message is contained in the response body.
- Returns:
- add_to_attention_set(input_)[source]
Adds a single user to the attention set of a change. support this method since v3.3.0
A user can only be added if they are not in the attention set. If a user is added while already in the attention set, the request is silently ignored.
input_ = { "user": "John Doe", "reason": "reason" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.add_to_attention_set(input_)
- Parameters:
input – the AttentionSetInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input
- Returns:
- check_submit_requirement(input_)[source]
Tests a submit requirement.
- Parameters:
input – the SubmitRequirementInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-input
- Returns:
- consistency_check()[source]
Performs consistency checks on the change, and returns a ChangeInfo entity with the problems field set to a list of ProblemInfo entities.
- Returns:
- create_merge_patch_set(input_)[source]
Update an existing change by using a MergePatchSetInput entity. Gerrit will create a merge commit based on the information of MergePatchSetInput and add a new patch set to the change corresponding to the new merge commit.
input_ = { "subject": "Merge master into stable", "merge": { "source": "refs/heads/master" } } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.update(input_)
- Parameters:
input – the MergePatchSetInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#merge-patch-set-input
- Returns:
- delete_vote(account, label, input_=None)[source]
Deletes a single vote from a change. Note, that even when the last vote of a reviewer is removed the reviewer itself is still listed on the change. If another user removed a user’s vote, the user with the deleted vote will be added to the attention set.
input_ = { "notify": "NONE" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') change.delete_vote('John', 'Code-Review', input_) # or change.delete_vote('John', 'Code-Review')
- Parameters:
account –
label –
input – the DeleteVoteInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-vote-input
- Returns:
- fix(input_=None)[source]
Performs consistency checks on the change as with GET /check, and additionally fixes any problems that can be fixed automatically. The returned field values reflect any fixes. Some fixes have options controlling their behavior, which can be set in the FixInput entity body. Only the change owner, a project owner, or an administrator may fix changes.
input_ = { "delete_patch_set_if_commit_missing": "true", "expect_merged_as": "something" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.fix() # or result = change.fix(input_)
- Parameters:
input – the FixInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#fix-input
- Returns:
- get_attention_set()[source]
Returns all users that are currently in the attention set. support this method since v3.3.0
- Returns:
- get_detail(options=None)[source]
retrieve a change with labels, detailed labels, detailed accounts, reviewer updates, and messages.
- Parameters:
options – List of options to fetch additional data about a change
- Returns:
- get_edit()[source]
Retrieves a change edit details. As response an EditInfo entity is returned that describes the change edit, or 204 No Content when change edit doesn’t exist for this change.
- Returns:
- get_meta_diff(old=None, meta=None)[source]
Retrieves the difference between two historical states of a change by specifying the and the parameters. old=SHA-1,meta=SHA-1. If the parameter is not provided, the parent of the SHA-1 is used. If the parameter is not provided, the current state of the change is used. If neither are provided, the difference between the current state of the change and its previous state is returned.
- Parameters:
old –
meta –
- Returns:
- get_past_assignees()[source]
Returns a list of every user ever assigned to a change, in the order in which they were first assigned.
- Returns:
- get_pure_revert(commit)[source]
Check if the given change is a pure revert of the change it references in revertOf.
- Parameters:
commit – commit id
- Returns:
- get_revision(revision_id='current')[source]
Get one revision by revision SHA or integer number.
- Parameters:
revision_id – Optional ID. If not specified, the current revision will be retrieved. It supports SHA IDs and integer numbers from -X to +X, where X is the current (latest) revision. Zero means current revision. -N means the current revision number X minus N, so if the current revision is 50, and -1 is given, the revision 49 will be retrieved.
- Returns:
- get_topic()[source]
Retrieves the topic of a change.
- Getter:
Retrieves the topic of a change.
- Setter:
Sets the topic of a change.
- Deleter:
Deletes the topic of a change.
- Returns:
- ignore()[source]
Marks a change as ignored. The change will not be shown in the incoming reviews’ dashboard, and email notifications will be suppressed. Ignoring a change does not cause the change’s “updated” timestamp to be modified, and the owner is not notified.
- Returns:
- list_drafts()[source]
Lists the draft comments of all revisions of the change that belong to the calling user.
- Returns:
- list_submitted_together_changes()[source]
Computes list of all changes which are submitted when Submit is called for this change, including the current change itself.
- list_votes(account)[source]
Lists the votes for a specific reviewer of the change.
- Parameters:
account – account id or username
- Returns:
- mark_private(input_)[source]
Marks the change to be private. Only open changes can be marked private. Changes may only be marked private by the owner or site administrators.
input_ = { "message": "After this security fix has been released we can make it public now." } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') change.mark_private(input_)
- Parameters:
input – the PrivateInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#private-input
- Returns:
- property messages
- move(input_)[source]
Move a change. If the change cannot be moved because the change state doesn’t allow moving the change, the response is ‘409 Conflict’ and the error message is contained in the response body.
input_ = { "destination_branch" : "release-branch" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.move(input_)
- Parameters:
input – the MoveInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#move-input
- Returns:
- rebase(input_)[source]
Rebase a change. If the change cannot be rebased, e.g. due to conflicts, the response is ‘409 Conflict’ and the error message is contained in the response body.
input_ = { "base" : "1234", } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.rebase(input_)
- Parameters:
input – the RebaseInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#rebase-input
- Returns:
- remove_from_attention_set(id_, input_=None)[source]
Deletes a single user from the attention set of a change. support this method since v3.3.0
A user can only be removed from the attention set. if they are currently in the attention set. Otherwise, the request is silently ignored.
input_ = { "reason": "reason" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') change.remove_from_attention_set('kevin.shi', input_) # or change.remove_from_attention_set('kevin.shi')
- Parameters:
id – account id
input – the AttentionSetInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input
- Returns:
- restore()[source]
Restores a change. If the change cannot be restored because the change state doesn’t allow restoring the change, the response is “409 Conflict” and the error message is contained in the response body.
- Returns:
- revert(input_=None)[source]
Reverts a change. The request body does not need to include a RevertInput entity if no review comment is added.
If the user doesn’t have revert permission on the change or upload permission on the destination branch, the response is ‘403 Forbidden’, and the error message is contained in the response body.
If the change cannot be reverted because the change state doesn’t allow reverting the change, the response is 409 Conflict and the error message is contained in the response body.
input_ = { "message" : "Message to be added as review comment to the change when reverting the change." } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.revert() # or result = change.revert(input_)
- Parameters:
input – the RevertInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-input
- Returns:
- revert_submission()[source]
Creates open revert changes for all of the changes of a certain submission.
If the user doesn’t have revert permission on the change or upload permission on the destination, the response is ‘403 Forbidden’, and the error message is contained in the response body.
If the change cannot be reverted because the change state doesn’t allow reverting the change the response is ‘409 Conflict’, and the error message is contained in the response body.
- Returns:
- property reviewers
- set_assignee(input_)[source]
Sets the assignee of a change.
input_ = { "assignee": "jhon.doe" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.set_assignee(input_)
- Parameters:
input – the AssigneeInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#assignee-input
- Returns:
- set_commit_message(input_)[source]
Creates a new patch set with a new commit message.
input_ = { "message": "New Commit message \n\nChange-Id: I10394472cbd17dd12454f22b143a444\n" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.set_commit_message(input_)
- Parameters:
input – the CommitMessageInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-message-input
- Returns:
- set_hashtags(input_)[source]
Adds and/or removes hashtags from a change.
input_ = { "add" : [ "hashtag3" ], "remove" : [ "hashtag2" ] } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.set_hashtags(input_)
- Parameters:
input – the HashtagsInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#hashtags-input
- Returns:
- set_ready_for_review(input_)[source]
Marks the change as ready for review (set WIP property to false). Changes may only be marked ready by the owner, project owners or site administrators. Marking a change ready for review also adds all of the reviewers of the change to the attention set.
input_ = { 'message': 'Refactoring is done.' } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') change.set_ready_for_review(input_)
- Parameters:
input – the WorkInProgressInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#work-in-progress-input
- Returns:
- set_work_in_progress(input_=None)[source]
Marks the change as not ready for review yet. Changes may only be marked not ready by the owner, project owners or site administrators. Marking a change work in progress also removes all users from the attention set.
The request body does not need to include a WorkInProgressInput entity if no review comment is added.
input_ = { "message": "Refactoring needs to be done before we can proceed here." } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.set_work_in_progress(input_) # or result = change.set_work_in_progress()
- Parameters:
input – the WorkInProgressInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#work-in-progress-input
- Returns:
- submit(input_=None)[source]
Submits a change. Submitting a change also removes all users from the attention set.
If the change cannot be submitted because the submit rule doesn’t allow submitting the change, the response is 409 Conflict and the error message is contained in the response body.
input_ = { "on_behalf_of": 1001439 } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') result = change.submit(input_)
- Parameters:
input – the SubmitInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-input
- Returns:
- unmark_private(input_=None)[source]
Marks the change to be non-private. Note users can only unmark own private changes. If the change was already not private, the response is ‘409 Conflict’.
input_ = { "message": "This is a security fix that must not be public." } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') change.unmark_private(input_) # or change.unmark_private()
- Parameters:
input – the PrivateInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#private-input
- Returns:
gerrit.changes.changes module
- class gerrit.changes.changes.GerritChanges(gerrit)[source]
Bases:
object
- create(input_)[source]
create a change
input_ = { "project": "myProject", "subject": "Let's support 100% Gerrit workflow direct in browser", "branch": "stable", "topic": "create-change-in-browser", "status": "NEW" } result = client.changes.create(input_)
- Parameters:
input – the ChangeInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-input
- Returns:
- search(query: str, options=None, limit: int = 25, skip: int = 0)[source]
Queries changes visible to the caller.
query = "is:open+owner:self+is:mergeable" result = client.changes.search(query=query, options=["LABELS"])
- Parameters:
query – Query string, it can contain multiple search operators concatenated by ‘+’ character
options – List of options to fetch additional data about changes
limit – Int value that allows to limit the number of changes to be included in the output results
skip – Int value that allows to skip the given number of changes from the beginning of the list
- Returns:
gerrit.changes.comments module
- class gerrit.changes.comments.GerritChangeRevisionComment(id: str, change: str, revision: str, gerrit)[source]
Bases:
GerritBase
- delete(input_=None)[source]
Deletes a published comment of a revision. Instead of deleting the whole comment, this endpoint just replaces the comment’s message with a new message, which contains the name of the user who deletes the comment and the reason why it’s deleted.
input_ = { "reason": "contains confidential information" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') revision = change.get_revision('3848807f587dbd3a7e61723bbfbf1ad13ad5a00a') comment = revision.comments.get("e167e775_e069567a") result = comment.delete(input_) # or result = comment.delete()
- Parameters:
input – the DeleteCommentInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-comment-input
- Returns:
gerrit.changes.drafts module
- class gerrit.changes.drafts.GerritChangeRevisionDraft(id: str, change: str, revision: str, gerrit)[source]
Bases:
GerritBase
- update(input_)[source]
Updates a draft comment on a revision.
input_ = { "path": "sonarqube/cloud/duplications.py", "line": 25, "message": "[nit] trailing whitespace" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') revision = change.get_revision('3848807f587dbd3a7e61723bbfbf1ad13ad5a00a') draft = revision.drafts.get('89f04e8c_9b7fd51d') result = draft.update(input_)
- Parameters:
input – the CommentInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-input
- Returns:
- class gerrit.changes.drafts.GerritChangeRevisionDrafts(change, revision, gerrit)[source]
Bases:
object
- create(input_)[source]
Creates a draft comment on a revision.
input_ = { "path": "sonarqube/cloud/duplications.py", "line": 15, "message": "[nit] trailing whitespace" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') revision = change.get_revision('3848807f587dbd3a7e61723bbfbf1ad13ad5a00a') new_draft = revision.drafts.create(input_)
- Parameters:
input – the CommentInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-input
- Returns:
- delete(id_)[source]
Deletes a draft comment from a revision.
- Parameters:
id – the draft comment id
- Returns:
gerrit.changes.edit module
- class gerrit.changes.edit.GerritChangeEdit(change: str, gerrit)[source]
Bases:
GerritBase
- change_commit_message(input_)[source]
Modify commit message.
input_ = { "message": "New commit message\n\n Change-Id: I10394472cbd17dd12454f229e4f6de00b143a444" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') edit = change.get_edit() edit.change_commit_message(input_)
- Parameters:
input – the ChangeEditMessageInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-edit-message-input
- Returns:
- delete_file(file)[source]
Deletes a file from a change edit.
- Parameters:
file – Path to file to delete.
- Returns:
- get_change_file_content(file)[source]
Retrieves content of a file from a change edit. The content of the file is returned as text encoded inside base64.
- Parameters:
file – the file path
- Returns:
- get_commit_message()[source]
Retrieves commit message from change edit. The commit message is returned as base64 encoded string.
- Returns:
- get_file_meta_data(file)[source]
Retrieves meta data of a file from a change edit.
- Parameters:
file – the file path
- Returns:
- publish(input_)[source]
Promotes change edit to a regular patch set.
input_ = { "notify": "NONE" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') edit = change.get_edit() edit.publish(input_)
- Parameters:
input – the PublishChangeEditInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-change-edit-input
- Returns:
- put_change_file_content(file, file_content)[source]
Put content of a file to a change edit.
- Parameters:
file – the file path
file_content – the content of the file need to change
- Returns:
- rebase()[source]
Rebase change edit on top of the latest patch set. When change was rebased on top of the latest patch set, response ‘204 No Content’ is returned. When change edit is already based on top of the latest patch set, the response ‘409 Conflict’ is returned.
- Returns:
gerrit.changes.files module
- class gerrit.changes.files.GerritChangeRevisionFile(path: str, json: dict, change: str, revision: str, gerrit)[source]
Bases:
object
- delete_reviewed()[source]
Deletes the reviewed flag of the calling user from a file of a revision.
- Returns:
- download_content()[source]
Downloads the content of a file from a certain revision, in a safe format that poses no risk for inadvertent execution of untrusted code.
If the content type is defined as safe, the binary file content is returned verbatim. If the content type is not safe, the file is stored inside a ZIP file, containing a single entry with a random, unpredictable name having the same base and suffix as the true filename. The ZIP file is returned in verbatim binary form.
- Returns:
- get_content(decode=False)[source]
Gets the content of a file from a certain revision. The content is returned as base64 encoded string.
- Parameters:
decode – Decode bas64 to plain text.
- Returns:
- class gerrit.changes.files.GerritChangeRevisionFiles(change, revision, gerrit)[source]
Bases:
object
- search(reviewed: Optional[bool] = None, base: Optional[int] = None, q: Optional[str] = None, parent: Optional[int] = None)[source]
Lists the files that were modified, added or deleted in a revision. The reviewed, base, q, and parent are mutually exclusive. That is, only one of them may be used at a time.
- Parameters:
reviewed – return a list of the paths the caller has marked as reviewed
base – return a map of the files which are different in this commit compared to the given revision. The revision must correspond to a patch set in the change.
q – return a list of all files (modified or unmodified) that contain that substring in the path name.
parent – For merge commits only, the integer-valued request parameter changes the response to return a map of the files which are different in this commit compared to the given parent commit.
- Returns:
gerrit.changes.messages module
- class gerrit.changes.messages.GerritChangeMessage(id: str, change: str, gerrit)[source]
Bases:
GerritBase
- delete(input_=None)[source]
Deletes a change message. Note that only users with the Administrate Server global capability are permitted to delete a change message.
input_ = { "reason": "spam" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') message = change.messages.get("babf4c5dd53d7a11080696efa78830d0a07762e6") result = message.delete(input_) # or result = message.delete()
- Parameters:
input – the DeleteChangeMessageInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-change-message-input
- Returns:
gerrit.changes.reviewers module
- class gerrit.changes.reviewers.GerritChangeReviewer(account: str, change: str, gerrit)[source]
Bases:
GerritBase
- delete(input_=None)[source]
Deletes a reviewer from a change. Deleting a reviewer also removes that user from the attention set.
input_ = { "notify": "NONE" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') reviewer = change.reviewers.get('john.doe') reviewer.delete(input_) # or reviewer.delete()
- Parameters:
input – the DeleteReviewerInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-reviewer-input
- Returns:
- delete_vote(label, input_=None)[source]
Deletes a single vote from a change. Note, that even when the last vote of a reviewer is removed the reviewer itself is still listed on the change.
input_ = { "notify": "NONE" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') reviewer = change.reviewers.get('john.doe') reviewer.delete_vote('Code-Review', input_) # or reviewer.delete_vote('Code-Review')
- Parameters:
label –
input – the DeleteVoteInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-vote-input
- Returns:
- class gerrit.changes.reviewers.GerritChangeReviewers(change, gerrit)[source]
Bases:
object
- add(input_)[source]
Adds one user or all members of one group as reviewer to the change.
Users can be moved from reviewer to CC and vice versa. This means if a user is added as CC that is already a reviewer on the change, the reviewer state of that user is updated to CC. If a user that is already a CC on the change is added as reviewer, the reviewer state of that user is updated to reviewer.
Adding a new reviewer also adds that reviewer to the attention set, unless the change is work in progress. Also, moving a reviewer to CC removes that user from the attention set.
input_ = { "reviewer": "john.doe" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') new_reviewer = change.reviewers.add(input_)
- Parameters:
input – the ReviewerInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-input
- Returns:
gerrit.changes.revision module
- class gerrit.changes.revision.GerritChangeRevision(gerrit, change, revision='current')[source]
Bases:
object
- cherry_pick(input_)[source]
Cherry picks a revision to a destination branch.
input_ = { "message" : "Implementing Feature X", "destination" : "release-branch" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') revision = change.get_revision('3848807f587dbd3a7e61723bbfbf1ad13ad5a00a') result = revision.cherry_pick(input_)
- Parameters:
input – the CherryPickInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#cherry-pick-commit
- Returns:
- property comments
- delete_vote(account, label, input_=None)[source]
Deletes a single vote from a revision. The deletion will be possible only if the revision is the current revision. By using this endpoint you can prevent deleting the vote (with same label) from a newer patch set by mistake. Note, that even when the last vote of a reviewer is removed the reviewer itself is still listed on the change.
input_ = { "notify": "NONE" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') revision = change.get_revision("0f4f97b5af9a965e082fb8cde082c5f1ba2fe930") revision.delete_vote('John', 'Code-Review', input_) # or revision.delete_vote('John', 'Code-Review')
- Parameters:
account –
label –
input – the DeleteVoteInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-vote-input
- Returns:
- property drafts
- property files
- get_description()[source]
Retrieves the description of a patch set. If the patch set does not have a description an empty string is returned.
- Returns:
- get_merge_list()[source]
Returns the list of commits that are being integrated into a target branch by a merge commit. By default, the first parent is assumed to be uninteresting. By using the parent option another parent can be set as uninteresting (parents are 1-based).
- Returns:
- get_patch(zip_=False, download=False, path=None, decode=False)[source]
Gets the formatted patch for one revision. The formatted patch is returned as text encoded inside base64 if decode is False.
Adding query parameter zip (for example /changes/…/patch?zip) returns the patch as a single file inside of a ZIP archive. Clients can expand the ZIP to obtain the plain text patch, avoiding the need for a base64 decoding step. This option implies download.
Query parameter download (e.g. /changes/…/patch?download) will suggest the browser save the patch as commitsha1.diff.base64, for later processing by command line tools.
If the path parameter is set, the returned content is a diff of the single file that the path refers to.
- Parameters:
zip –
download –
path –
decode – Decode bas64 to plain text.
- Returns:
Retrieves related changes of a revision. Related changes are changes that either depend on, or are dependencies of the revision.
- Returns:
- get_robot_comment(commit_id)[source]
Retrieves a robot comment of a revision.
- Parameters:
commit_id –
- Returns:
- get_submit_type()[source]
Gets the method the server will use to submit (merge) the change.
- Returns:
- is_mergeable()[source]
Gets the method the server will use to submit (merge) the change and an indicator if the change is currently mergeable.
- Returns:
- list_votes(account)[source]
Lists the votes for a specific reviewer of the revision.
- Parameters:
account – account id or username
- Returns:
- rebase(input_)[source]
Rebases a revision. Optionally, the parent revision can be changed to another patch set through the RebaseInput entity.
input_ = { "base" : "1234" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') revision = change.get_revision('3848807f587dbd3a7e61723bbfbf1ad13ad5a00a') result = revision.rebase(input_)
- Parameters:
input – the RebaseInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#rebase-input
- Returns:
- set_description(input_)[source]
Sets the description of a patch set.
input_ = { "description": "Added Documentation" } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') revision = change.get_revision('3848807f587dbd3a7e61723bbfbf1ad13ad5a00a') result = revision.set_description(input_)
- Parameters:
input – the DescriptionInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#description-input
- Returns:
- set_review(input_)[source]
Sets a review on a revision, optionally also publishing draft comments, setting labels, adding reviewers or CCs, and modifying the work in progress property. A review cannot be set on a change edit. Trying to post a review for a change edit fails with 409 Conflict.
input_ = { "tag": "jenkins", "message": "Some nits need to be fixed.", "labels": { "Code-Review": -1 }, "comments": { "sonarqube/cloud/project_badges.py": [ { "line": 23, "message": "[nit] trailing whitespace" }, { "line": 49, "message": "[nit] s/conrtol/control" }, { "range": { "start_line": 50, "start_character": 0, "end_line": 55, "end_character": 20 }, "message": "Incorrect indentation" } ] } } change = client.changes.get('Project~stable~I10394472cbd17dd12454f229e4f6de00b143a444') revision = change.get_revision('3848807f587dbd3a7e61723bbfbf1ad13ad5a00a') result = revision.set_review(input_)
- Parameters:
input – the ReviewInput entity, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-input
- Returns:
- submit()[source]
Submits a revision. If the revision cannot be submitted, e.g. because the submit rule doesn’t allow submitting the revision or the revision is not the current revision, the response is 409 Conflict and the error message is contained in the response body.
- Returns:
- submit_preview()[source]
need fix bug Gets a file containing thin bundles of all modified projects if this change was submitted.
- Returns: