Show More
@@ -1,421 +1,428 b'' | |||
|
1 | 1 | .. _pull-request-methods-ref: |
|
2 | 2 | |
|
3 | 3 | pull_request methods |
|
4 | 4 | ==================== |
|
5 | 5 | |
|
6 | 6 | close_pull_request |
|
7 | 7 | ------------------ |
|
8 | 8 | |
|
9 | 9 | .. py:function:: close_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>) |
|
10 | 10 | |
|
11 | 11 | Close the pull request specified by `pullrequestid`. |
|
12 | 12 | |
|
13 | 13 | :param apiuser: This is filled automatically from the |authtoken|. |
|
14 | 14 | :type apiuser: AuthUser |
|
15 | 15 | :param repoid: Repository name or repository ID to which the pull |
|
16 | 16 | request belongs. |
|
17 | 17 | :type repoid: str or int |
|
18 | 18 | :param pullrequestid: ID of the pull request to be closed. |
|
19 | 19 | :type pullrequestid: int |
|
20 | 20 | :param userid: Close the pull request as this user. |
|
21 | 21 | :type userid: Optional(str or int) |
|
22 | 22 | :param message: Optional message to close the Pull Request with. If not |
|
23 | 23 | specified it will be generated automatically. |
|
24 | 24 | :type message: Optional(str) |
|
25 | 25 | |
|
26 | 26 | Example output: |
|
27 | 27 | |
|
28 | 28 | .. code-block:: bash |
|
29 | 29 | |
|
30 | 30 | "id": <id_given_in_input>, |
|
31 | 31 | "result": { |
|
32 | 32 | "pull_request_id": "<int>", |
|
33 | 33 | "close_status": "<str:status_lbl>, |
|
34 | 34 | "closed": "<bool>" |
|
35 | 35 | }, |
|
36 | 36 | "error": null |
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | comment_pull_request |
|
40 | 40 | -------------------- |
|
41 | 41 | |
|
42 | 42 | .. py:function:: 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>, userid=<Optional:<OptionalAttr:apiuser>>) |
|
43 | 43 | |
|
44 | 44 | Comment on the pull request specified with the `pullrequestid`, |
|
45 | 45 | in the |repo| specified by the `repoid`, and optionally change the |
|
46 | 46 | review status. |
|
47 | 47 | |
|
48 | 48 | :param apiuser: This is filled automatically from the |authtoken|. |
|
49 | 49 | :type apiuser: AuthUser |
|
50 | 50 | :param repoid: Optional repository name or repository ID. |
|
51 | 51 | :type repoid: str or int |
|
52 | 52 | :param pullrequestid: The pull request ID. |
|
53 | 53 | :type pullrequestid: int |
|
54 | 54 | :param commit_id: Specify the commit_id for which to set a comment. If |
|
55 | 55 | given commit_id is different than latest in the PR status |
|
56 | 56 | change won't be performed. |
|
57 | 57 | :type commit_id: str |
|
58 | 58 | :param message: The text content of the comment. |
|
59 | 59 | :type message: str |
|
60 | 60 | :param status: (**Optional**) Set the approval status of the pull |
|
61 | 61 | request. One of: 'not_reviewed', 'approved', 'rejected', |
|
62 | 62 | 'under_review' |
|
63 | 63 | :type status: str |
|
64 | 64 | :param comment_type: Comment type, one of: 'note', 'todo' |
|
65 | 65 | :type comment_type: Optional(str), default: 'note' |
|
66 | 66 | :param userid: Comment on the pull request as this user |
|
67 | 67 | :type userid: Optional(str or int) |
|
68 | 68 | |
|
69 | 69 | Example output: |
|
70 | 70 | |
|
71 | 71 | .. code-block:: bash |
|
72 | 72 | |
|
73 | 73 | id : <id_given_in_input> |
|
74 | 74 | result : { |
|
75 | 75 | "pull_request_id": "<Integer>", |
|
76 | 76 | "comment_id": "<Integer>", |
|
77 | 77 | "status": {"given": <given_status>, |
|
78 | 78 | "was_changed": <bool status_was_actually_changed> }, |
|
79 | 79 | }, |
|
80 | 80 | error : null |
|
81 | 81 | |
|
82 | 82 | |
|
83 | 83 | create_pull_request |
|
84 | 84 | ------------------- |
|
85 | 85 | |
|
86 | .. py:function:: create_pull_request(apiuser, source_repo, target_repo, source_ref, target_ref, title, description=<Optional:''>, reviewers=<Optional:None>) | |
|
86 | .. py:function:: create_pull_request(apiuser, source_repo, target_repo, source_ref, target_ref, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>) | |
|
87 | 87 | |
|
88 | 88 | Creates a new pull request. |
|
89 | 89 | |
|
90 | 90 | Accepts refs in the following formats: |
|
91 | 91 | |
|
92 | 92 | * branch:<branch_name>:<sha> |
|
93 | 93 | * branch:<branch_name> |
|
94 | 94 | * bookmark:<bookmark_name>:<sha> (Mercurial only) |
|
95 | 95 | * bookmark:<bookmark_name> (Mercurial only) |
|
96 | 96 | |
|
97 | 97 | :param apiuser: This is filled automatically from the |authtoken|. |
|
98 | 98 | :type apiuser: AuthUser |
|
99 | 99 | :param source_repo: Set the source repository name. |
|
100 | 100 | :type source_repo: str |
|
101 | 101 | :param target_repo: Set the target repository name. |
|
102 | 102 | :type target_repo: str |
|
103 | 103 | :param source_ref: Set the source ref name. |
|
104 | 104 | :type source_ref: str |
|
105 | 105 | :param target_ref: Set the target ref name. |
|
106 | 106 | :type target_ref: str |
|
107 |
:param title: Set the pull request title |
|
|
107 | :param title: Optionally Set the pull request title, it's generated otherwise | |
|
108 | 108 | :type title: str |
|
109 | 109 | :param description: Set the pull request description. |
|
110 | 110 | :type description: Optional(str) |
|
111 | :type description_renderer: Optional(str) | |
|
112 | :param description_renderer: Set pull request renderer for the description. | |
|
113 | It should be 'rst', 'markdown' or 'plain'. If not give default | |
|
114 | system renderer will be used | |
|
111 | 115 | :param reviewers: Set the new pull request reviewers list. |
|
112 | 116 | Reviewer defined by review rules will be added automatically to the |
|
113 | 117 | defined list. |
|
114 | 118 | :type reviewers: Optional(list) |
|
115 | 119 | Accepts username strings or objects of the format: |
|
116 | 120 | |
|
117 | 121 | [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}] |
|
118 | 122 | |
|
119 | 123 | |
|
120 | 124 | get_pull_request |
|
121 | 125 | ---------------- |
|
122 | 126 | |
|
123 | 127 | .. py:function:: get_pull_request(apiuser, pullrequestid, repoid=<Optional:None>) |
|
124 | 128 | |
|
125 | 129 | Get a pull request based on the given ID. |
|
126 | 130 | |
|
127 | 131 | :param apiuser: This is filled automatically from the |authtoken|. |
|
128 | 132 | :type apiuser: AuthUser |
|
129 | 133 | :param repoid: Optional, repository name or repository ID from where |
|
130 | 134 | the pull request was opened. |
|
131 | 135 | :type repoid: str or int |
|
132 | 136 | :param pullrequestid: ID of the requested pull request. |
|
133 | 137 | :type pullrequestid: int |
|
134 | 138 | |
|
135 | 139 | Example output: |
|
136 | 140 | |
|
137 | 141 | .. code-block:: bash |
|
138 | 142 | |
|
139 | 143 | "id": <id_given_in_input>, |
|
140 | 144 | "result": |
|
141 | 145 | { |
|
142 | 146 | "pull_request_id": "<pull_request_id>", |
|
143 | 147 | "url": "<url>", |
|
144 | 148 | "title": "<title>", |
|
145 | 149 | "description": "<description>", |
|
146 | 150 | "status" : "<status>", |
|
147 | 151 | "created_on": "<date_time_created>", |
|
148 | 152 | "updated_on": "<date_time_updated>", |
|
149 | 153 | "commit_ids": [ |
|
150 | 154 | ... |
|
151 | 155 | "<commit_id>", |
|
152 | 156 | "<commit_id>", |
|
153 | 157 | ... |
|
154 | 158 | ], |
|
155 | 159 | "review_status": "<review_status>", |
|
156 | 160 | "mergeable": { |
|
157 | 161 | "status": "<bool>", |
|
158 | 162 | "message": "<message>", |
|
159 | 163 | }, |
|
160 | 164 | "source": { |
|
161 | 165 | "clone_url": "<clone_url>", |
|
162 | 166 | "repository": "<repository_name>", |
|
163 | 167 | "reference": |
|
164 | 168 | { |
|
165 | 169 | "name": "<name>", |
|
166 | 170 | "type": "<type>", |
|
167 | 171 | "commit_id": "<commit_id>", |
|
168 | 172 | } |
|
169 | 173 | }, |
|
170 | 174 | "target": { |
|
171 | 175 | "clone_url": "<clone_url>", |
|
172 | 176 | "repository": "<repository_name>", |
|
173 | 177 | "reference": |
|
174 | 178 | { |
|
175 | 179 | "name": "<name>", |
|
176 | 180 | "type": "<type>", |
|
177 | 181 | "commit_id": "<commit_id>", |
|
178 | 182 | } |
|
179 | 183 | }, |
|
180 | 184 | "merge": { |
|
181 | 185 | "clone_url": "<clone_url>", |
|
182 | 186 | "reference": |
|
183 | 187 | { |
|
184 | 188 | "name": "<name>", |
|
185 | 189 | "type": "<type>", |
|
186 | 190 | "commit_id": "<commit_id>", |
|
187 | 191 | } |
|
188 | 192 | }, |
|
189 | 193 | "author": <user_obj>, |
|
190 | 194 | "reviewers": [ |
|
191 | 195 | ... |
|
192 | 196 | { |
|
193 | 197 | "user": "<user_obj>", |
|
194 | 198 | "review_status": "<review_status>", |
|
195 | 199 | } |
|
196 | 200 | ... |
|
197 | 201 | ] |
|
198 | 202 | }, |
|
199 | 203 | "error": null |
|
200 | 204 | |
|
201 | 205 | |
|
202 | 206 | get_pull_request_comments |
|
203 | 207 | ------------------------- |
|
204 | 208 | |
|
205 | 209 | .. py:function:: get_pull_request_comments(apiuser, pullrequestid, repoid=<Optional:None>) |
|
206 | 210 | |
|
207 | 211 | Get all comments of pull request specified with the `pullrequestid` |
|
208 | 212 | |
|
209 | 213 | :param apiuser: This is filled automatically from the |authtoken|. |
|
210 | 214 | :type apiuser: AuthUser |
|
211 | 215 | :param repoid: Optional repository name or repository ID. |
|
212 | 216 | :type repoid: str or int |
|
213 | 217 | :param pullrequestid: The pull request ID. |
|
214 | 218 | :type pullrequestid: int |
|
215 | 219 | |
|
216 | 220 | Example output: |
|
217 | 221 | |
|
218 | 222 | .. code-block:: bash |
|
219 | 223 | |
|
220 | 224 | id : <id_given_in_input> |
|
221 | 225 | result : [ |
|
222 | 226 | { |
|
223 | 227 | "comment_author": { |
|
224 | 228 | "active": true, |
|
225 | 229 | "full_name_or_username": "Tom Gore", |
|
226 | 230 | "username": "admin" |
|
227 | 231 | }, |
|
228 | 232 | "comment_created_on": "2017-01-02T18:43:45.533", |
|
229 | 233 | "comment_f_path": null, |
|
230 | 234 | "comment_id": 25, |
|
231 | 235 | "comment_lineno": null, |
|
232 | 236 | "comment_status": { |
|
233 | 237 | "status": "under_review", |
|
234 | 238 | "status_lbl": "Under Review" |
|
235 | 239 | }, |
|
236 | 240 | "comment_text": "Example text", |
|
237 | 241 | "comment_type": null, |
|
238 | 242 | "pull_request_version": null |
|
239 | 243 | } |
|
240 | 244 | ], |
|
241 | 245 | error : null |
|
242 | 246 | |
|
243 | 247 | |
|
244 | 248 | get_pull_requests |
|
245 | 249 | ----------------- |
|
246 | 250 | |
|
247 | 251 | .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>) |
|
248 | 252 | |
|
249 | 253 | Get all pull requests from the repository specified in `repoid`. |
|
250 | 254 | |
|
251 | 255 | :param apiuser: This is filled automatically from the |authtoken|. |
|
252 | 256 | :type apiuser: AuthUser |
|
253 | 257 | :param repoid: Optional repository name or repository ID. |
|
254 | 258 | :type repoid: str or int |
|
255 | 259 | :param status: Only return pull requests with the specified status. |
|
256 | 260 | Valid options are. |
|
257 | 261 | * ``new`` (default) |
|
258 | 262 | * ``open`` |
|
259 | 263 | * ``closed`` |
|
260 | 264 | :type status: str |
|
261 | 265 | |
|
262 | 266 | Example output: |
|
263 | 267 | |
|
264 | 268 | .. code-block:: bash |
|
265 | 269 | |
|
266 | 270 | "id": <id_given_in_input>, |
|
267 | 271 | "result": |
|
268 | 272 | [ |
|
269 | 273 | ... |
|
270 | 274 | { |
|
271 | 275 | "pull_request_id": "<pull_request_id>", |
|
272 | 276 | "url": "<url>", |
|
273 | 277 | "title" : "<title>", |
|
274 | 278 | "description": "<description>", |
|
275 | 279 | "status": "<status>", |
|
276 | 280 | "created_on": "<date_time_created>", |
|
277 | 281 | "updated_on": "<date_time_updated>", |
|
278 | 282 | "commit_ids": [ |
|
279 | 283 | ... |
|
280 | 284 | "<commit_id>", |
|
281 | 285 | "<commit_id>", |
|
282 | 286 | ... |
|
283 | 287 | ], |
|
284 | 288 | "review_status": "<review_status>", |
|
285 | 289 | "mergeable": { |
|
286 | 290 | "status": "<bool>", |
|
287 | 291 | "message: "<message>", |
|
288 | 292 | }, |
|
289 | 293 | "source": { |
|
290 | 294 | "clone_url": "<clone_url>", |
|
291 | 295 | "reference": |
|
292 | 296 | { |
|
293 | 297 | "name": "<name>", |
|
294 | 298 | "type": "<type>", |
|
295 | 299 | "commit_id": "<commit_id>", |
|
296 | 300 | } |
|
297 | 301 | }, |
|
298 | 302 | "target": { |
|
299 | 303 | "clone_url": "<clone_url>", |
|
300 | 304 | "reference": |
|
301 | 305 | { |
|
302 | 306 | "name": "<name>", |
|
303 | 307 | "type": "<type>", |
|
304 | 308 | "commit_id": "<commit_id>", |
|
305 | 309 | } |
|
306 | 310 | }, |
|
307 | 311 | "merge": { |
|
308 | 312 | "clone_url": "<clone_url>", |
|
309 | 313 | "reference": |
|
310 | 314 | { |
|
311 | 315 | "name": "<name>", |
|
312 | 316 | "type": "<type>", |
|
313 | 317 | "commit_id": "<commit_id>", |
|
314 | 318 | } |
|
315 | 319 | }, |
|
316 | 320 | "author": <user_obj>, |
|
317 | 321 | "reviewers": [ |
|
318 | 322 | ... |
|
319 | 323 | { |
|
320 | 324 | "user": "<user_obj>", |
|
321 | 325 | "review_status": "<review_status>", |
|
322 | 326 | } |
|
323 | 327 | ... |
|
324 | 328 | ] |
|
325 | 329 | } |
|
326 | 330 | ... |
|
327 | 331 | ], |
|
328 | 332 | "error": null |
|
329 | 333 | |
|
330 | 334 | |
|
331 | 335 | merge_pull_request |
|
332 | 336 | ------------------ |
|
333 | 337 | |
|
334 | 338 | .. py:function:: merge_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>) |
|
335 | 339 | |
|
336 | 340 | Merge the pull request specified by `pullrequestid` into its target |
|
337 | 341 | repository. |
|
338 | 342 | |
|
339 | 343 | :param apiuser: This is filled automatically from the |authtoken|. |
|
340 | 344 | :type apiuser: AuthUser |
|
341 | 345 | :param repoid: Optional, repository name or repository ID of the |
|
342 | 346 | target repository to which the |pr| is to be merged. |
|
343 | 347 | :type repoid: str or int |
|
344 | 348 | :param pullrequestid: ID of the pull request which shall be merged. |
|
345 | 349 | :type pullrequestid: int |
|
346 | 350 | :param userid: Merge the pull request as this user. |
|
347 | 351 | :type userid: Optional(str or int) |
|
348 | 352 | |
|
349 | 353 | Example output: |
|
350 | 354 | |
|
351 | 355 | .. code-block:: bash |
|
352 | 356 | |
|
353 | 357 | "id": <id_given_in_input>, |
|
354 | 358 | "result": { |
|
355 | 359 | "executed": "<bool>", |
|
356 | 360 | "failure_reason": "<int>", |
|
357 | 361 | "merge_commit_id": "<merge_commit_id>", |
|
358 | 362 | "possible": "<bool>", |
|
359 | 363 | "merge_ref": { |
|
360 | 364 | "commit_id": "<commit_id>", |
|
361 | 365 | "type": "<type>", |
|
362 | 366 | "name": "<name>" |
|
363 | 367 | } |
|
364 | 368 | }, |
|
365 | 369 | "error": null |
|
366 | 370 | |
|
367 | 371 | |
|
368 | 372 | update_pull_request |
|
369 | 373 | ------------------- |
|
370 | 374 | |
|
371 | .. py:function:: update_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>) | |
|
375 | .. py:function:: update_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>) | |
|
372 | 376 | |
|
373 | 377 | Updates a pull request. |
|
374 | 378 | |
|
375 | 379 | :param apiuser: This is filled automatically from the |authtoken|. |
|
376 | 380 | :type apiuser: AuthUser |
|
377 | 381 | :param repoid: Optional repository name or repository ID. |
|
378 | 382 | :type repoid: str or int |
|
379 | 383 | :param pullrequestid: The pull request ID. |
|
380 | 384 | :type pullrequestid: int |
|
381 | 385 | :param title: Set the pull request title. |
|
382 | 386 | :type title: str |
|
383 | 387 | :param description: Update pull request description. |
|
384 | 388 | :type description: Optional(str) |
|
389 | :type description_renderer: Optional(str) | |
|
390 | :param description_renderer: Update pull request renderer for the description. | |
|
391 | It should be 'rst', 'markdown' or 'plain' | |
|
385 | 392 | :param reviewers: Update pull request reviewers list with new value. |
|
386 | 393 | :type reviewers: Optional(list) |
|
387 | 394 | Accepts username strings or objects of the format: |
|
388 | 395 | |
|
389 | 396 | [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}] |
|
390 | 397 | |
|
391 | 398 | :param update_commits: Trigger update of commits for this pull request |
|
392 | 399 | :type: update_commits: Optional(bool) |
|
393 | 400 | |
|
394 | 401 | Example output: |
|
395 | 402 | |
|
396 | 403 | .. code-block:: bash |
|
397 | 404 | |
|
398 | 405 | id : <id_given_in_input> |
|
399 | 406 | result : { |
|
400 | 407 | "msg": "Updated pull request `63`", |
|
401 | 408 | "pull_request": <pull_request_object>, |
|
402 | 409 | "updated_reviewers": { |
|
403 | 410 | "added": [ |
|
404 | 411 | "username" |
|
405 | 412 | ], |
|
406 | 413 | "removed": [] |
|
407 | 414 | }, |
|
408 | 415 | "updated_commits": { |
|
409 | 416 | "added": [ |
|
410 | 417 | "<sha1_hash>" |
|
411 | 418 | ], |
|
412 | 419 | "common": [ |
|
413 | 420 | "<sha1_hash>", |
|
414 | 421 | "<sha1_hash>", |
|
415 | 422 | ], |
|
416 | 423 | "removed": [] |
|
417 | 424 | } |
|
418 | 425 | } |
|
419 | 426 | error : null |
|
420 | 427 | |
|
421 | 428 |
General Comments 0
You need to be logged in to leave comments.
Login now