pull_request methods¶
close_pull_request¶
-
close_pull_request
(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>)¶ Close the pull request specified by pullrequestid.
Parameters: - apiuser (AuthUser) – This is filled automatically from the Authentication Token.
- repoid (str or int) – Repository name or repository ID to which the pull request belongs.
- pullrequestid (int) – ID of the pull request to be closed.
- userid (Optional(str or int)) – Close the pull request as this user.
- message (Optional(str)) – Optional message to close the Pull Request with. If not specified it will be generated automatically.
Example output:
"id": <id_given_in_input>, "result": { "pull_request_id": "<int>", "close_status": "<str:status_lbl>, "closed": "<bool>" }, "error": null
comment_pull_request¶
-
comment_pull_request
(apiuser, pullrequestid, repoid=<Optional:None>, message=<Optional:None>, commit_id=<Optional:None>, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, extra_recipients=<Optional:[]>, userid=<Optional:<OptionalAttr:apiuser>>, send_email=<Optional:True>)¶ Comment on the pull request specified with the pullrequestid, in the repository specified by the repoid, and optionally change the review status.
Parameters: - apiuser (AuthUser) – This is filled automatically from the Authentication Token.
- repoid (str or int) – Optional repository name or repository ID.
- pullrequestid (int) – The pull request ID.
- commit_id (str) – Specify the commit_id for which to set a comment. If given commit_id is different than latest in the PR status change won’t be performed.
- message (str) – The text content of the comment.
- status (str) – (Optional) Set the approval status of the pull request. One of: ‘not_reviewed’, ‘approved’, ‘rejected’, ‘under_review’
- comment_type (Optional(str), default: 'note') – Comment type, one of: ‘note’, ‘todo’
- resolves_comment_id (Optional(int)) – id of comment which this one will resolve
- extra_recipients (Optional(list)) – list of user ids or usernames to add notifications for this comment. Acts like a CC for notification
- userid (Optional(str or int)) – Comment on the pull request as this user
- send_email (Optional(bool)) – Define if this comment should also send email notification
Example output:
id : <id_given_in_input> result : { "pull_request_id": "<Integer>", "comment_id": "<Integer>", "status": {"given": <given_status>, "was_changed": <bool status_was_actually_changed> }, }, error : null
create_pull_request¶
-
create_pull_request
(apiuser, source_repo, target_repo, source_ref, target_ref, owner=<Optional:<OptionalAttr:apiuser>>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>, observers=<Optional:None>)¶ Creates a new pull request.
Accepts refs in the following formats:
- branch:<branch_name>:<sha>
- branch:<branch_name>
- bookmark:<bookmark_name>:<sha> (Mercurial only)
- bookmark:<bookmark_name> (Mercurial only)
Parameters: - apiuser (AuthUser) – This is filled automatically from the Authentication Token.
- source_repo (str) – Set the source repository name.
- target_repo (str) – Set the target repository name.
- source_ref (str) – Set the source ref name.
- target_ref (str) – Set the target ref name.
- owner (Optional(str)) – user_id or username
- title (str) – Optionally Set the pull request title, it’s generated otherwise
- description (Optional(str)) – Set the pull request description.
- description_renderer (Optional(str)) – Set pull request renderer for the description. It should be ‘rst’, ‘markdown’ or ‘plain’. If not give default system renderer will be used
- reviewers – Set the new pull request reviewers list. Reviewer defined by review rules will be added automatically to the defined list.
- observers – Set the new pull request observers list. Reviewer defined by review rules will be added automatically to the defined list. This feature is only available in RhodeCode EE
get_pull_request¶
-
get_pull_request
(apiuser, pullrequestid, repoid=<Optional:None>, merge_state=<Optional:False>)¶ Get a pull request based on the given ID.
Parameters: - apiuser (AuthUser) – This is filled automatically from the Authentication Token.
- repoid (str or int) – Optional, repository name or repository ID from where the pull request was opened.
- pullrequestid (int) – ID of the requested pull request.
- merge_state (bool) – Optional calculate merge state for each repository. This could result in longer time to fetch the data
Example output:
"id": <id_given_in_input>, "result": { "pull_request_id": "<pull_request_id>", "url": "<url>", "title": "<title>", "description": "<description>", "status" : "<status>", "created_on": "<date_time_created>", "updated_on": "<date_time_updated>", "versions": "<number_or_versions_of_pr>", "commit_ids": [ ... "<commit_id>", "<commit_id>", ... ], "review_status": "<review_status>", "mergeable": { "status": "<bool>", "message": "<message>", }, "source": { "clone_url": "<clone_url>", "repository": "<repository_name>", "reference": { "name": "<name>", "type": "<type>", "commit_id": "<commit_id>", } }, "target": { "clone_url": "<clone_url>", "repository": "<repository_name>", "reference": { "name": "<name>", "type": "<type>", "commit_id": "<commit_id>", } }, "merge": { "clone_url": "<clone_url>", "reference": { "name": "<name>", "type": "<type>", "commit_id": "<commit_id>", } }, "author": <user_obj>, "reviewers": [ ... { "user": "<user_obj>", "review_status": "<review_status>", } ... ] }, "error": null
get_pull_request_comments¶
-
get_pull_request_comments
(apiuser, pullrequestid, repoid=<Optional:None>)¶ Get all comments of pull request specified with the pullrequestid
Parameters: - apiuser (AuthUser) – This is filled automatically from the Authentication Token.
- repoid (str or int) – Optional repository name or repository ID.
- pullrequestid (int) – The pull request ID.
Example output:
id : <id_given_in_input> result : [ { "comment_author": { "active": true, "full_name_or_username": "Tom Gore", "username": "admin" }, "comment_created_on": "2017-01-02T18:43:45.533", "comment_f_path": null, "comment_id": 25, "comment_lineno": null, "comment_status": { "status": "under_review", "status_lbl": "Under Review" }, "comment_text": "Example text", "comment_type": null, "comment_last_version: 0, "pull_request_version": null, "comment_commit_id": None, "comment_pull_request_id": <pull_request_id> } ], error : null
get_pull_requests¶
-
get_pull_requests
(apiuser, repoid, status=<Optional:'new'>, merge_state=<Optional:False>)¶ Get all pull requests from the repository specified in repoid.
Parameters: - apiuser (AuthUser) – This is filled automatically from the Authentication Token.
- repoid (str or int) – Optional repository name or repository ID.
- status (str) – Only return pull requests with the specified status.
Valid options are.
*
new
(default) *open
*closed
- merge_state (bool) – Optional calculate merge state for each repository. This could result in longer time to fetch the data
Example output:
"id": <id_given_in_input>, "result": [ ... { "pull_request_id": "<pull_request_id>", "url": "<url>", "title" : "<title>", "description": "<description>", "status": "<status>", "created_on": "<date_time_created>", "updated_on": "<date_time_updated>", "commit_ids": [ ... "<commit_id>", "<commit_id>", ... ], "review_status": "<review_status>", "mergeable": { "status": "<bool>", "message: "<message>", }, "source": { "clone_url": "<clone_url>", "reference": { "name": "<name>", "type": "<type>", "commit_id": "<commit_id>", } }, "target": { "clone_url": "<clone_url>", "reference": { "name": "<name>", "type": "<type>", "commit_id": "<commit_id>", } }, "merge": { "clone_url": "<clone_url>", "reference": { "name": "<name>", "type": "<type>", "commit_id": "<commit_id>", } }, "author": <user_obj>, "reviewers": [ ... { "user": "<user_obj>", "review_status": "<review_status>", } ... ] } ... ], "error": null
merge_pull_request¶
-
merge_pull_request
(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)¶ Merge the pull request specified by pullrequestid into its target repository.
Parameters: - apiuser (AuthUser) – This is filled automatically from the Authentication Token.
- repoid (str or int) – Optional, repository name or repository ID of the target repository to which the pull request is to be merged.
- pullrequestid (int) – ID of the pull request which shall be merged.
- userid (Optional(str or int)) – Merge the pull request as this user.
Example output:
"id": <id_given_in_input>, "result": { "executed": "<bool>", "failure_reason": "<int>", "merge_status_message": "<str>", "merge_commit_id": "<merge_commit_id>", "possible": "<bool>", "merge_ref": { "commit_id": "<commit_id>", "type": "<type>", "name": "<name>" } }, "error": null
update_pull_request¶
-
update_pull_request
(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>, observers=<Optional:None>, update_commits=<Optional:None>)¶ Updates a pull request.
Parameters: - apiuser (AuthUser) – This is filled automatically from the Authentication Token.
- repoid (str or int) – Optional repository name or repository ID.
- pullrequestid (int) – The pull request ID.
- title (str) – Set the pull request title.
- description (Optional(str)) – Update pull request description.
- description_renderer (Optional(str)) – Update pull request renderer for the description. It should be ‘rst’, ‘markdown’ or ‘plain’
- reviewers – Update pull request reviewers list with new value.
- observers – Update pull request observers list with new value.
- update_commits – Trigger update of commits for this pull request
Type: update_commits: Optional(bool)
Example output:
id : <id_given_in_input> result : { "msg": "Updated pull request `63`", "pull_request": <pull_request_object>, "updated_reviewers": { "added": [ "username" ], "removed": [] }, "updated_observers": { "added": [ "username" ], "removed": [] }, "updated_commits": { "added": [ "<sha1_hash>" ], "common": [ "<sha1_hash>", "<sha1_hash>", ], "removed": [] } } error : null