##// END OF EJS Templates
docs: updated API documentation
marcink -
r4455:043990e1 default
parent child Browse files
Show More
@@ -1,447 +1,448 b''
1 .. _pull-request-methods-ref:
1 .. _pull-request-methods-ref:
2
2
3 pull_request methods
3 pull_request methods
4 ====================
4 ====================
5
5
6 close_pull_request
6 close_pull_request
7 ------------------
7 ------------------
8
8
9 .. py:function:: close_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>)
9 .. py:function:: close_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>)
10
10
11 Close the pull request specified by `pullrequestid`.
11 Close the pull request specified by `pullrequestid`.
12
12
13 :param apiuser: This is filled automatically from the |authtoken|.
13 :param apiuser: This is filled automatically from the |authtoken|.
14 :type apiuser: AuthUser
14 :type apiuser: AuthUser
15 :param repoid: Repository name or repository ID to which the pull
15 :param repoid: Repository name or repository ID to which the pull
16 request belongs.
16 request belongs.
17 :type repoid: str or int
17 :type repoid: str or int
18 :param pullrequestid: ID of the pull request to be closed.
18 :param pullrequestid: ID of the pull request to be closed.
19 :type pullrequestid: int
19 :type pullrequestid: int
20 :param userid: Close the pull request as this user.
20 :param userid: Close the pull request as this user.
21 :type userid: Optional(str or int)
21 :type userid: Optional(str or int)
22 :param message: Optional message to close the Pull Request with. If not
22 :param message: Optional message to close the Pull Request with. If not
23 specified it will be generated automatically.
23 specified it will be generated automatically.
24 :type message: Optional(str)
24 :type message: Optional(str)
25
25
26 Example output:
26 Example output:
27
27
28 .. code-block:: bash
28 .. code-block:: bash
29
29
30 "id": <id_given_in_input>,
30 "id": <id_given_in_input>,
31 "result": {
31 "result": {
32 "pull_request_id": "<int>",
32 "pull_request_id": "<int>",
33 "close_status": "<str:status_lbl>,
33 "close_status": "<str:status_lbl>,
34 "closed": "<bool>"
34 "closed": "<bool>"
35 },
35 },
36 "error": null
36 "error": null
37
37
38
38
39 comment_pull_request
39 comment_pull_request
40 --------------------
40 --------------------
41
41
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>, extra_recipients=<Optional:[]>, userid=<Optional:<OptionalAttr:apiuser>>, send_email=<Optional:True>)
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>, extra_recipients=<Optional:[]>, userid=<Optional:<OptionalAttr:apiuser>>, send_email=<Optional:True>)
43
43
44 Comment on the pull request specified with the `pullrequestid`,
44 Comment on the pull request specified with the `pullrequestid`,
45 in the |repo| specified by the `repoid`, and optionally change the
45 in the |repo| specified by the `repoid`, and optionally change the
46 review status.
46 review status.
47
47
48 :param apiuser: This is filled automatically from the |authtoken|.
48 :param apiuser: This is filled automatically from the |authtoken|.
49 :type apiuser: AuthUser
49 :type apiuser: AuthUser
50 :param repoid: Optional repository name or repository ID.
50 :param repoid: Optional repository name or repository ID.
51 :type repoid: str or int
51 :type repoid: str or int
52 :param pullrequestid: The pull request ID.
52 :param pullrequestid: The pull request ID.
53 :type pullrequestid: int
53 :type pullrequestid: int
54 :param commit_id: Specify the commit_id for which to set a comment. If
54 :param commit_id: Specify the commit_id for which to set a comment. If
55 given commit_id is different than latest in the PR status
55 given commit_id is different than latest in the PR status
56 change won't be performed.
56 change won't be performed.
57 :type commit_id: str
57 :type commit_id: str
58 :param message: The text content of the comment.
58 :param message: The text content of the comment.
59 :type message: str
59 :type message: str
60 :param status: (**Optional**) Set the approval status of the pull
60 :param status: (**Optional**) Set the approval status of the pull
61 request. One of: 'not_reviewed', 'approved', 'rejected',
61 request. One of: 'not_reviewed', 'approved', 'rejected',
62 'under_review'
62 'under_review'
63 :type status: str
63 :type status: str
64 :param comment_type: Comment type, one of: 'note', 'todo'
64 :param comment_type: Comment type, one of: 'note', 'todo'
65 :type comment_type: Optional(str), default: 'note'
65 :type comment_type: Optional(str), default: 'note'
66 :param resolves_comment_id: id of comment which this one will resolve
66 :param resolves_comment_id: id of comment which this one will resolve
67 :type resolves_comment_id: Optional(int)
67 :type resolves_comment_id: Optional(int)
68 :param extra_recipients: list of user ids or usernames to add
68 :param extra_recipients: list of user ids or usernames to add
69 notifications for this comment. Acts like a CC for notification
69 notifications for this comment. Acts like a CC for notification
70 :type extra_recipients: Optional(list)
70 :type extra_recipients: Optional(list)
71 :param userid: Comment on the pull request as this user
71 :param userid: Comment on the pull request as this user
72 :type userid: Optional(str or int)
72 :type userid: Optional(str or int)
73 :param send_email: Define if this comment should also send email notification
73 :param send_email: Define if this comment should also send email notification
74 :type send_email: Optional(bool)
74 :type send_email: Optional(bool)
75
75
76 Example output:
76 Example output:
77
77
78 .. code-block:: bash
78 .. code-block:: bash
79
79
80 id : <id_given_in_input>
80 id : <id_given_in_input>
81 result : {
81 result : {
82 "pull_request_id": "<Integer>",
82 "pull_request_id": "<Integer>",
83 "comment_id": "<Integer>",
83 "comment_id": "<Integer>",
84 "status": {"given": <given_status>,
84 "status": {"given": <given_status>,
85 "was_changed": <bool status_was_actually_changed> },
85 "was_changed": <bool status_was_actually_changed> },
86 },
86 },
87 error : null
87 error : null
88
88
89
89
90 create_pull_request
90 create_pull_request
91 -------------------
91 -------------------
92
92
93 .. py:function:: 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>)
93 .. py:function:: 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>)
94
94
95 Creates a new pull request.
95 Creates a new pull request.
96
96
97 Accepts refs in the following formats:
97 Accepts refs in the following formats:
98
98
99 * branch:<branch_name>:<sha>
99 * branch:<branch_name>:<sha>
100 * branch:<branch_name>
100 * branch:<branch_name>
101 * bookmark:<bookmark_name>:<sha> (Mercurial only)
101 * bookmark:<bookmark_name>:<sha> (Mercurial only)
102 * bookmark:<bookmark_name> (Mercurial only)
102 * bookmark:<bookmark_name> (Mercurial only)
103
103
104 :param apiuser: This is filled automatically from the |authtoken|.
104 :param apiuser: This is filled automatically from the |authtoken|.
105 :type apiuser: AuthUser
105 :type apiuser: AuthUser
106 :param source_repo: Set the source repository name.
106 :param source_repo: Set the source repository name.
107 :type source_repo: str
107 :type source_repo: str
108 :param target_repo: Set the target repository name.
108 :param target_repo: Set the target repository name.
109 :type target_repo: str
109 :type target_repo: str
110 :param source_ref: Set the source ref name.
110 :param source_ref: Set the source ref name.
111 :type source_ref: str
111 :type source_ref: str
112 :param target_ref: Set the target ref name.
112 :param target_ref: Set the target ref name.
113 :type target_ref: str
113 :type target_ref: str
114 :param owner: user_id or username
114 :param owner: user_id or username
115 :type owner: Optional(str)
115 :type owner: Optional(str)
116 :param title: Optionally Set the pull request title, it's generated otherwise
116 :param title: Optionally Set the pull request title, it's generated otherwise
117 :type title: str
117 :type title: str
118 :param description: Set the pull request description.
118 :param description: Set the pull request description.
119 :type description: Optional(str)
119 :type description: Optional(str)
120 :type description_renderer: Optional(str)
120 :type description_renderer: Optional(str)
121 :param description_renderer: Set pull request renderer for the description.
121 :param description_renderer: Set pull request renderer for the description.
122 It should be 'rst', 'markdown' or 'plain'. If not give default
122 It should be 'rst', 'markdown' or 'plain'. If not give default
123 system renderer will be used
123 system renderer will be used
124 :param reviewers: Set the new pull request reviewers list.
124 :param reviewers: Set the new pull request reviewers list.
125 Reviewer defined by review rules will be added automatically to the
125 Reviewer defined by review rules will be added automatically to the
126 defined list.
126 defined list.
127 :type reviewers: Optional(list)
127 :type reviewers: Optional(list)
128 Accepts username strings or objects of the format:
128 Accepts username strings or objects of the format:
129
129
130 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
130 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
131
131
132
132
133 get_pull_request
133 get_pull_request
134 ----------------
134 ----------------
135
135
136 .. py:function:: get_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, merge_state=<Optional:False>)
136 .. py:function:: get_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, merge_state=<Optional:False>)
137
137
138 Get a pull request based on the given ID.
138 Get a pull request based on the given ID.
139
139
140 :param apiuser: This is filled automatically from the |authtoken|.
140 :param apiuser: This is filled automatically from the |authtoken|.
141 :type apiuser: AuthUser
141 :type apiuser: AuthUser
142 :param repoid: Optional, repository name or repository ID from where
142 :param repoid: Optional, repository name or repository ID from where
143 the pull request was opened.
143 the pull request was opened.
144 :type repoid: str or int
144 :type repoid: str or int
145 :param pullrequestid: ID of the requested pull request.
145 :param pullrequestid: ID of the requested pull request.
146 :type pullrequestid: int
146 :type pullrequestid: int
147 :param merge_state: Optional calculate merge state for each repository.
147 :param merge_state: Optional calculate merge state for each repository.
148 This could result in longer time to fetch the data
148 This could result in longer time to fetch the data
149 :type merge_state: bool
149 :type merge_state: bool
150
150
151 Example output:
151 Example output:
152
152
153 .. code-block:: bash
153 .. code-block:: bash
154
154
155 "id": <id_given_in_input>,
155 "id": <id_given_in_input>,
156 "result":
156 "result":
157 {
157 {
158 "pull_request_id": "<pull_request_id>",
158 "pull_request_id": "<pull_request_id>",
159 "url": "<url>",
159 "url": "<url>",
160 "title": "<title>",
160 "title": "<title>",
161 "description": "<description>",
161 "description": "<description>",
162 "status" : "<status>",
162 "status" : "<status>",
163 "created_on": "<date_time_created>",
163 "created_on": "<date_time_created>",
164 "updated_on": "<date_time_updated>",
164 "updated_on": "<date_time_updated>",
165 "versions": "<number_or_versions_of_pr>",
165 "versions": "<number_or_versions_of_pr>",
166 "commit_ids": [
166 "commit_ids": [
167 ...
167 ...
168 "<commit_id>",
168 "<commit_id>",
169 "<commit_id>",
169 "<commit_id>",
170 ...
170 ...
171 ],
171 ],
172 "review_status": "<review_status>",
172 "review_status": "<review_status>",
173 "mergeable": {
173 "mergeable": {
174 "status": "<bool>",
174 "status": "<bool>",
175 "message": "<message>",
175 "message": "<message>",
176 },
176 },
177 "source": {
177 "source": {
178 "clone_url": "<clone_url>",
178 "clone_url": "<clone_url>",
179 "repository": "<repository_name>",
179 "repository": "<repository_name>",
180 "reference":
180 "reference":
181 {
181 {
182 "name": "<name>",
182 "name": "<name>",
183 "type": "<type>",
183 "type": "<type>",
184 "commit_id": "<commit_id>",
184 "commit_id": "<commit_id>",
185 }
185 }
186 },
186 },
187 "target": {
187 "target": {
188 "clone_url": "<clone_url>",
188 "clone_url": "<clone_url>",
189 "repository": "<repository_name>",
189 "repository": "<repository_name>",
190 "reference":
190 "reference":
191 {
191 {
192 "name": "<name>",
192 "name": "<name>",
193 "type": "<type>",
193 "type": "<type>",
194 "commit_id": "<commit_id>",
194 "commit_id": "<commit_id>",
195 }
195 }
196 },
196 },
197 "merge": {
197 "merge": {
198 "clone_url": "<clone_url>",
198 "clone_url": "<clone_url>",
199 "reference":
199 "reference":
200 {
200 {
201 "name": "<name>",
201 "name": "<name>",
202 "type": "<type>",
202 "type": "<type>",
203 "commit_id": "<commit_id>",
203 "commit_id": "<commit_id>",
204 }
204 }
205 },
205 },
206 "author": <user_obj>,
206 "author": <user_obj>,
207 "reviewers": [
207 "reviewers": [
208 ...
208 ...
209 {
209 {
210 "user": "<user_obj>",
210 "user": "<user_obj>",
211 "review_status": "<review_status>",
211 "review_status": "<review_status>",
212 }
212 }
213 ...
213 ...
214 ]
214 ]
215 },
215 },
216 "error": null
216 "error": null
217
217
218
218
219 get_pull_request_comments
219 get_pull_request_comments
220 -------------------------
220 -------------------------
221
221
222 .. py:function:: get_pull_request_comments(apiuser, pullrequestid, repoid=<Optional:None>)
222 .. py:function:: get_pull_request_comments(apiuser, pullrequestid, repoid=<Optional:None>)
223
223
224 Get all comments of pull request specified with the `pullrequestid`
224 Get all comments of pull request specified with the `pullrequestid`
225
225
226 :param apiuser: This is filled automatically from the |authtoken|.
226 :param apiuser: This is filled automatically from the |authtoken|.
227 :type apiuser: AuthUser
227 :type apiuser: AuthUser
228 :param repoid: Optional repository name or repository ID.
228 :param repoid: Optional repository name or repository ID.
229 :type repoid: str or int
229 :type repoid: str or int
230 :param pullrequestid: The pull request ID.
230 :param pullrequestid: The pull request ID.
231 :type pullrequestid: int
231 :type pullrequestid: int
232
232
233 Example output:
233 Example output:
234
234
235 .. code-block:: bash
235 .. code-block:: bash
236
236
237 id : <id_given_in_input>
237 id : <id_given_in_input>
238 result : [
238 result : [
239 {
239 {
240 "comment_author": {
240 "comment_author": {
241 "active": true,
241 "active": true,
242 "full_name_or_username": "Tom Gore",
242 "full_name_or_username": "Tom Gore",
243 "username": "admin"
243 "username": "admin"
244 },
244 },
245 "comment_created_on": "2017-01-02T18:43:45.533",
245 "comment_created_on": "2017-01-02T18:43:45.533",
246 "comment_f_path": null,
246 "comment_f_path": null,
247 "comment_id": 25,
247 "comment_id": 25,
248 "comment_lineno": null,
248 "comment_lineno": null,
249 "comment_status": {
249 "comment_status": {
250 "status": "under_review",
250 "status": "under_review",
251 "status_lbl": "Under Review"
251 "status_lbl": "Under Review"
252 },
252 },
253 "comment_text": "Example text",
253 "comment_text": "Example text",
254 "comment_type": null,
254 "comment_type": null,
255 "comment_last_version: 0,
255 "pull_request_version": null,
256 "pull_request_version": null,
256 "comment_commit_id": None,
257 "comment_commit_id": None,
257 "comment_pull_request_id": <pull_request_id>
258 "comment_pull_request_id": <pull_request_id>
258 }
259 }
259 ],
260 ],
260 error : null
261 error : null
261
262
262
263
263 get_pull_requests
264 get_pull_requests
264 -----------------
265 -----------------
265
266
266 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>, merge_state=<Optional:False>)
267 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>, merge_state=<Optional:False>)
267
268
268 Get all pull requests from the repository specified in `repoid`.
269 Get all pull requests from the repository specified in `repoid`.
269
270
270 :param apiuser: This is filled automatically from the |authtoken|.
271 :param apiuser: This is filled automatically from the |authtoken|.
271 :type apiuser: AuthUser
272 :type apiuser: AuthUser
272 :param repoid: Optional repository name or repository ID.
273 :param repoid: Optional repository name or repository ID.
273 :type repoid: str or int
274 :type repoid: str or int
274 :param status: Only return pull requests with the specified status.
275 :param status: Only return pull requests with the specified status.
275 Valid options are.
276 Valid options are.
276 * ``new`` (default)
277 * ``new`` (default)
277 * ``open``
278 * ``open``
278 * ``closed``
279 * ``closed``
279 :type status: str
280 :type status: str
280 :param merge_state: Optional calculate merge state for each repository.
281 :param merge_state: Optional calculate merge state for each repository.
281 This could result in longer time to fetch the data
282 This could result in longer time to fetch the data
282 :type merge_state: bool
283 :type merge_state: bool
283
284
284 Example output:
285 Example output:
285
286
286 .. code-block:: bash
287 .. code-block:: bash
287
288
288 "id": <id_given_in_input>,
289 "id": <id_given_in_input>,
289 "result":
290 "result":
290 [
291 [
291 ...
292 ...
292 {
293 {
293 "pull_request_id": "<pull_request_id>",
294 "pull_request_id": "<pull_request_id>",
294 "url": "<url>",
295 "url": "<url>",
295 "title" : "<title>",
296 "title" : "<title>",
296 "description": "<description>",
297 "description": "<description>",
297 "status": "<status>",
298 "status": "<status>",
298 "created_on": "<date_time_created>",
299 "created_on": "<date_time_created>",
299 "updated_on": "<date_time_updated>",
300 "updated_on": "<date_time_updated>",
300 "commit_ids": [
301 "commit_ids": [
301 ...
302 ...
302 "<commit_id>",
303 "<commit_id>",
303 "<commit_id>",
304 "<commit_id>",
304 ...
305 ...
305 ],
306 ],
306 "review_status": "<review_status>",
307 "review_status": "<review_status>",
307 "mergeable": {
308 "mergeable": {
308 "status": "<bool>",
309 "status": "<bool>",
309 "message: "<message>",
310 "message: "<message>",
310 },
311 },
311 "source": {
312 "source": {
312 "clone_url": "<clone_url>",
313 "clone_url": "<clone_url>",
313 "reference":
314 "reference":
314 {
315 {
315 "name": "<name>",
316 "name": "<name>",
316 "type": "<type>",
317 "type": "<type>",
317 "commit_id": "<commit_id>",
318 "commit_id": "<commit_id>",
318 }
319 }
319 },
320 },
320 "target": {
321 "target": {
321 "clone_url": "<clone_url>",
322 "clone_url": "<clone_url>",
322 "reference":
323 "reference":
323 {
324 {
324 "name": "<name>",
325 "name": "<name>",
325 "type": "<type>",
326 "type": "<type>",
326 "commit_id": "<commit_id>",
327 "commit_id": "<commit_id>",
327 }
328 }
328 },
329 },
329 "merge": {
330 "merge": {
330 "clone_url": "<clone_url>",
331 "clone_url": "<clone_url>",
331 "reference":
332 "reference":
332 {
333 {
333 "name": "<name>",
334 "name": "<name>",
334 "type": "<type>",
335 "type": "<type>",
335 "commit_id": "<commit_id>",
336 "commit_id": "<commit_id>",
336 }
337 }
337 },
338 },
338 "author": <user_obj>,
339 "author": <user_obj>,
339 "reviewers": [
340 "reviewers": [
340 ...
341 ...
341 {
342 {
342 "user": "<user_obj>",
343 "user": "<user_obj>",
343 "review_status": "<review_status>",
344 "review_status": "<review_status>",
344 }
345 }
345 ...
346 ...
346 ]
347 ]
347 }
348 }
348 ...
349 ...
349 ],
350 ],
350 "error": null
351 "error": null
351
352
352
353
353 merge_pull_request
354 merge_pull_request
354 ------------------
355 ------------------
355
356
356 .. py:function:: merge_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
357 .. py:function:: merge_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
357
358
358 Merge the pull request specified by `pullrequestid` into its target
359 Merge the pull request specified by `pullrequestid` into its target
359 repository.
360 repository.
360
361
361 :param apiuser: This is filled automatically from the |authtoken|.
362 :param apiuser: This is filled automatically from the |authtoken|.
362 :type apiuser: AuthUser
363 :type apiuser: AuthUser
363 :param repoid: Optional, repository name or repository ID of the
364 :param repoid: Optional, repository name or repository ID of the
364 target repository to which the |pr| is to be merged.
365 target repository to which the |pr| is to be merged.
365 :type repoid: str or int
366 :type repoid: str or int
366 :param pullrequestid: ID of the pull request which shall be merged.
367 :param pullrequestid: ID of the pull request which shall be merged.
367 :type pullrequestid: int
368 :type pullrequestid: int
368 :param userid: Merge the pull request as this user.
369 :param userid: Merge the pull request as this user.
369 :type userid: Optional(str or int)
370 :type userid: Optional(str or int)
370
371
371 Example output:
372 Example output:
372
373
373 .. code-block:: bash
374 .. code-block:: bash
374
375
375 "id": <id_given_in_input>,
376 "id": <id_given_in_input>,
376 "result": {
377 "result": {
377 "executed": "<bool>",
378 "executed": "<bool>",
378 "failure_reason": "<int>",
379 "failure_reason": "<int>",
379 "merge_status_message": "<str>",
380 "merge_status_message": "<str>",
380 "merge_commit_id": "<merge_commit_id>",
381 "merge_commit_id": "<merge_commit_id>",
381 "possible": "<bool>",
382 "possible": "<bool>",
382 "merge_ref": {
383 "merge_ref": {
383 "commit_id": "<commit_id>",
384 "commit_id": "<commit_id>",
384 "type": "<type>",
385 "type": "<type>",
385 "name": "<name>"
386 "name": "<name>"
386 }
387 }
387 },
388 },
388 "error": null
389 "error": null
389
390
390
391
391 update_pull_request
392 update_pull_request
392 -------------------
393 -------------------
393
394
394 .. py:function:: update_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>)
395 .. py:function:: update_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>)
395
396
396 Updates a pull request.
397 Updates a pull request.
397
398
398 :param apiuser: This is filled automatically from the |authtoken|.
399 :param apiuser: This is filled automatically from the |authtoken|.
399 :type apiuser: AuthUser
400 :type apiuser: AuthUser
400 :param repoid: Optional repository name or repository ID.
401 :param repoid: Optional repository name or repository ID.
401 :type repoid: str or int
402 :type repoid: str or int
402 :param pullrequestid: The pull request ID.
403 :param pullrequestid: The pull request ID.
403 :type pullrequestid: int
404 :type pullrequestid: int
404 :param title: Set the pull request title.
405 :param title: Set the pull request title.
405 :type title: str
406 :type title: str
406 :param description: Update pull request description.
407 :param description: Update pull request description.
407 :type description: Optional(str)
408 :type description: Optional(str)
408 :type description_renderer: Optional(str)
409 :type description_renderer: Optional(str)
409 :param description_renderer: Update pull request renderer for the description.
410 :param description_renderer: Update pull request renderer for the description.
410 It should be 'rst', 'markdown' or 'plain'
411 It should be 'rst', 'markdown' or 'plain'
411 :param reviewers: Update pull request reviewers list with new value.
412 :param reviewers: Update pull request reviewers list with new value.
412 :type reviewers: Optional(list)
413 :type reviewers: Optional(list)
413 Accepts username strings or objects of the format:
414 Accepts username strings or objects of the format:
414
415
415 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
416 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
416
417
417 :param update_commits: Trigger update of commits for this pull request
418 :param update_commits: Trigger update of commits for this pull request
418 :type: update_commits: Optional(bool)
419 :type: update_commits: Optional(bool)
419
420
420 Example output:
421 Example output:
421
422
422 .. code-block:: bash
423 .. code-block:: bash
423
424
424 id : <id_given_in_input>
425 id : <id_given_in_input>
425 result : {
426 result : {
426 "msg": "Updated pull request `63`",
427 "msg": "Updated pull request `63`",
427 "pull_request": <pull_request_object>,
428 "pull_request": <pull_request_object>,
428 "updated_reviewers": {
429 "updated_reviewers": {
429 "added": [
430 "added": [
430 "username"
431 "username"
431 ],
432 ],
432 "removed": []
433 "removed": []
433 },
434 },
434 "updated_commits": {
435 "updated_commits": {
435 "added": [
436 "added": [
436 "<sha1_hash>"
437 "<sha1_hash>"
437 ],
438 ],
438 "common": [
439 "common": [
439 "<sha1_hash>",
440 "<sha1_hash>",
440 "<sha1_hash>",
441 "<sha1_hash>",
441 ],
442 ],
442 "removed": []
443 "removed": []
443 }
444 }
444 }
445 }
445 error : null
446 error : null
446
447
447
448
@@ -1,1140 +1,1206 b''
1 .. _repo-methods-ref:
1 .. _repo-methods-ref:
2
2
3 repo methods
3 repo methods
4 ============
4 ============
5
5
6 add_field_to_repo
6 add_field_to_repo
7 -----------------
7 -----------------
8
8
9 .. py:function:: add_field_to_repo(apiuser, repoid, key, label=<Optional:''>, description=<Optional:''>)
9 .. py:function:: add_field_to_repo(apiuser, repoid, key, label=<Optional:''>, description=<Optional:''>)
10
10
11 Adds an extra field to a repository.
11 Adds an extra field to a repository.
12
12
13 This command can only be run using an |authtoken| with at least
13 This command can only be run using an |authtoken| with at least
14 write permissions to the |repo|.
14 write permissions to the |repo|.
15
15
16 :param apiuser: This is filled automatically from the |authtoken|.
16 :param apiuser: This is filled automatically from the |authtoken|.
17 :type apiuser: AuthUser
17 :type apiuser: AuthUser
18 :param repoid: Set the repository name or repository id.
18 :param repoid: Set the repository name or repository id.
19 :type repoid: str or int
19 :type repoid: str or int
20 :param key: Create a unique field key for this repository.
20 :param key: Create a unique field key for this repository.
21 :type key: str
21 :type key: str
22 :param label:
22 :param label:
23 :type label: Optional(str)
23 :type label: Optional(str)
24 :param description:
24 :param description:
25 :type description: Optional(str)
25 :type description: Optional(str)
26
26
27
27
28 comment_commit
28 comment_commit
29 --------------
29 --------------
30
30
31 .. py:function:: comment_commit(apiuser, repoid, commit_id, message, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, extra_recipients=<Optional:[]>, userid=<Optional:<OptionalAttr:apiuser>>, send_email=<Optional:True>)
31 .. py:function:: comment_commit(apiuser, repoid, commit_id, message, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, extra_recipients=<Optional:[]>, userid=<Optional:<OptionalAttr:apiuser>>, send_email=<Optional:True>)
32
32
33 Set a commit comment, and optionally change the status of the commit.
33 Set a commit comment, and optionally change the status of the commit.
34
34
35 :param apiuser: This is filled automatically from the |authtoken|.
35 :param apiuser: This is filled automatically from the |authtoken|.
36 :type apiuser: AuthUser
36 :type apiuser: AuthUser
37 :param repoid: Set the repository name or repository ID.
37 :param repoid: Set the repository name or repository ID.
38 :type repoid: str or int
38 :type repoid: str or int
39 :param commit_id: Specify the commit_id for which to set a comment.
39 :param commit_id: Specify the commit_id for which to set a comment.
40 :type commit_id: str
40 :type commit_id: str
41 :param message: The comment text.
41 :param message: The comment text.
42 :type message: str
42 :type message: str
43 :param status: (**Optional**) status of commit, one of: 'not_reviewed',
43 :param status: (**Optional**) status of commit, one of: 'not_reviewed',
44 'approved', 'rejected', 'under_review'
44 'approved', 'rejected', 'under_review'
45 :type status: str
45 :type status: str
46 :param comment_type: Comment type, one of: 'note', 'todo'
46 :param comment_type: Comment type, one of: 'note', 'todo'
47 :type comment_type: Optional(str), default: 'note'
47 :type comment_type: Optional(str), default: 'note'
48 :param resolves_comment_id: id of comment which this one will resolve
48 :param resolves_comment_id: id of comment which this one will resolve
49 :type resolves_comment_id: Optional(int)
49 :type resolves_comment_id: Optional(int)
50 :param extra_recipients: list of user ids or usernames to add
50 :param extra_recipients: list of user ids or usernames to add
51 notifications for this comment. Acts like a CC for notification
51 notifications for this comment. Acts like a CC for notification
52 :type extra_recipients: Optional(list)
52 :type extra_recipients: Optional(list)
53 :param userid: Set the user name of the comment creator.
53 :param userid: Set the user name of the comment creator.
54 :type userid: Optional(str or int)
54 :type userid: Optional(str or int)
55 :param send_email: Define if this comment should also send email notification
55 :param send_email: Define if this comment should also send email notification
56 :type send_email: Optional(bool)
56 :type send_email: Optional(bool)
57
57
58 Example error output:
58 Example error output:
59
59
60 .. code-block:: bash
60 .. code-block:: bash
61
61
62 {
62 {
63 "id" : <id_given_in_input>,
63 "id" : <id_given_in_input>,
64 "result" : {
64 "result" : {
65 "msg": "Commented on commit `<commit_id>` for repository `<repoid>`",
65 "msg": "Commented on commit `<commit_id>` for repository `<repoid>`",
66 "status_change": null or <status>,
66 "status_change": null or <status>,
67 "success": true
67 "success": true
68 },
68 },
69 "error" : null
69 "error" : null
70 }
70 }
71
71
72
72
73 create_repo
73 create_repo
74 -----------
74 -----------
75
75
76 .. py:function:: create_repo(apiuser, repo_name, repo_type, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, copy_permissions=<Optional:False>)
76 .. py:function:: create_repo(apiuser, repo_name, repo_type, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, copy_permissions=<Optional:False>)
77
77
78 Creates a repository.
78 Creates a repository.
79
79
80 * If the repository name contains "/", repository will be created inside
80 * If the repository name contains "/", repository will be created inside
81 a repository group or nested repository groups
81 a repository group or nested repository groups
82
82
83 For example "foo/bar/repo1" will create |repo| called "repo1" inside
83 For example "foo/bar/repo1" will create |repo| called "repo1" inside
84 group "foo/bar". You have to have permissions to access and write to
84 group "foo/bar". You have to have permissions to access and write to
85 the last repository group ("bar" in this example)
85 the last repository group ("bar" in this example)
86
86
87 This command can only be run using an |authtoken| with at least
87 This command can only be run using an |authtoken| with at least
88 permissions to create repositories, or write permissions to
88 permissions to create repositories, or write permissions to
89 parent repository groups.
89 parent repository groups.
90
90
91 :param apiuser: This is filled automatically from the |authtoken|.
91 :param apiuser: This is filled automatically from the |authtoken|.
92 :type apiuser: AuthUser
92 :type apiuser: AuthUser
93 :param repo_name: Set the repository name.
93 :param repo_name: Set the repository name.
94 :type repo_name: str
94 :type repo_name: str
95 :param repo_type: Set the repository type; 'hg','git', or 'svn'.
95 :param repo_type: Set the repository type; 'hg','git', or 'svn'.
96 :type repo_type: str
96 :type repo_type: str
97 :param owner: user_id or username
97 :param owner: user_id or username
98 :type owner: Optional(str)
98 :type owner: Optional(str)
99 :param description: Set the repository description.
99 :param description: Set the repository description.
100 :type description: Optional(str)
100 :type description: Optional(str)
101 :param private: set repository as private
101 :param private: set repository as private
102 :type private: bool
102 :type private: bool
103 :param clone_uri: set clone_uri
103 :param clone_uri: set clone_uri
104 :type clone_uri: str
104 :type clone_uri: str
105 :param push_uri: set push_uri
105 :param push_uri: set push_uri
106 :type push_uri: str
106 :type push_uri: str
107 :param landing_rev: <rev_type>:<rev>, e.g branch:default, book:dev, rev:abcd
107 :param landing_rev: <rev_type>:<rev>, e.g branch:default, book:dev, rev:abcd
108 :type landing_rev: str
108 :type landing_rev: str
109 :param enable_locking:
109 :param enable_locking:
110 :type enable_locking: bool
110 :type enable_locking: bool
111 :param enable_downloads:
111 :param enable_downloads:
112 :type enable_downloads: bool
112 :type enable_downloads: bool
113 :param enable_statistics:
113 :param enable_statistics:
114 :type enable_statistics: bool
114 :type enable_statistics: bool
115 :param copy_permissions: Copy permission from group in which the
115 :param copy_permissions: Copy permission from group in which the
116 repository is being created.
116 repository is being created.
117 :type copy_permissions: bool
117 :type copy_permissions: bool
118
118
119
119
120 Example output:
120 Example output:
121
121
122 .. code-block:: bash
122 .. code-block:: bash
123
123
124 id : <id_given_in_input>
124 id : <id_given_in_input>
125 result: {
125 result: {
126 "msg": "Created new repository `<reponame>`",
126 "msg": "Created new repository `<reponame>`",
127 "success": true,
127 "success": true,
128 "task": "<celery task id or None if done sync>"
128 "task": "<celery task id or None if done sync>"
129 }
129 }
130 error: null
130 error: null
131
131
132
132
133 Example error output:
133 Example error output:
134
134
135 .. code-block:: bash
135 .. code-block:: bash
136
136
137 id : <id_given_in_input>
137 id : <id_given_in_input>
138 result : null
138 result : null
139 error : {
139 error : {
140 'failed to create repository `<repo_name>`'
140 'failed to create repository `<repo_name>`'
141 }
141 }
142
142
143
143
144 delete_repo
144 delete_repo
145 -----------
145 -----------
146
146
147 .. py:function:: delete_repo(apiuser, repoid, forks=<Optional:''>)
147 .. py:function:: delete_repo(apiuser, repoid, forks=<Optional:''>)
148
148
149 Deletes a repository.
149 Deletes a repository.
150
150
151 * When the `forks` parameter is set it's possible to detach or delete
151 * When the `forks` parameter is set it's possible to detach or delete
152 forks of deleted repository.
152 forks of deleted repository.
153
153
154 This command can only be run using an |authtoken| with admin
154 This command can only be run using an |authtoken| with admin
155 permissions on the |repo|.
155 permissions on the |repo|.
156
156
157 :param apiuser: This is filled automatically from the |authtoken|.
157 :param apiuser: This is filled automatically from the |authtoken|.
158 :type apiuser: AuthUser
158 :type apiuser: AuthUser
159 :param repoid: Set the repository name or repository ID.
159 :param repoid: Set the repository name or repository ID.
160 :type repoid: str or int
160 :type repoid: str or int
161 :param forks: Set to `detach` or `delete` forks from the |repo|.
161 :param forks: Set to `detach` or `delete` forks from the |repo|.
162 :type forks: Optional(str)
162 :type forks: Optional(str)
163
163
164 Example error output:
164 Example error output:
165
165
166 .. code-block:: bash
166 .. code-block:: bash
167
167
168 id : <id_given_in_input>
168 id : <id_given_in_input>
169 result: {
169 result: {
170 "msg": "Deleted repository `<reponame>`",
170 "msg": "Deleted repository `<reponame>`",
171 "success": true
171 "success": true
172 }
172 }
173 error: null
173 error: null
174
174
175
175
176 edit_comment
177 ------------
178
179 .. py:function:: edit_comment(apiuser, message, comment_id, version, userid=<Optional:<OptionalAttr:apiuser>>)
180
181 Edit comment on the pull request or commit,
182 specified by the `comment_id` and version. Initially version should be 0
183
184 :param apiuser: This is filled automatically from the |authtoken|.
185 :type apiuser: AuthUser
186 :param comment_id: Specify the comment_id for editing
187 :type comment_id: int
188 :param version: version of the comment that will be created, starts from 0
189 :type version: int
190 :param message: The text content of the comment.
191 :type message: str
192 :param userid: Comment on the pull request as this user
193 :type userid: Optional(str or int)
194
195 Example output:
196
197 .. code-block:: bash
198
199 id : <id_given_in_input>
200 result : {
201 "comment": "<comment data>",
202 "version": "<Integer>",
203 },
204 error : null
205
206
176 fork_repo
207 fork_repo
177 ---------
208 ---------
178
209
179 .. py:function:: fork_repo(apiuser, repoid, fork_name, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, landing_rev=<Optional:None>, copy_permissions=<Optional:False>)
210 .. py:function:: fork_repo(apiuser, repoid, fork_name, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, landing_rev=<Optional:None>, copy_permissions=<Optional:False>)
180
211
181 Creates a fork of the specified |repo|.
212 Creates a fork of the specified |repo|.
182
213
183 * If the fork_name contains "/", fork will be created inside
214 * If the fork_name contains "/", fork will be created inside
184 a repository group or nested repository groups
215 a repository group or nested repository groups
185
216
186 For example "foo/bar/fork-repo" will create fork called "fork-repo"
217 For example "foo/bar/fork-repo" will create fork called "fork-repo"
187 inside group "foo/bar". You have to have permissions to access and
218 inside group "foo/bar". You have to have permissions to access and
188 write to the last repository group ("bar" in this example)
219 write to the last repository group ("bar" in this example)
189
220
190 This command can only be run using an |authtoken| with minimum
221 This command can only be run using an |authtoken| with minimum
191 read permissions of the forked repo, create fork permissions for an user.
222 read permissions of the forked repo, create fork permissions for an user.
192
223
193 :param apiuser: This is filled automatically from the |authtoken|.
224 :param apiuser: This is filled automatically from the |authtoken|.
194 :type apiuser: AuthUser
225 :type apiuser: AuthUser
195 :param repoid: Set repository name or repository ID.
226 :param repoid: Set repository name or repository ID.
196 :type repoid: str or int
227 :type repoid: str or int
197 :param fork_name: Set the fork name, including it's repository group membership.
228 :param fork_name: Set the fork name, including it's repository group membership.
198 :type fork_name: str
229 :type fork_name: str
199 :param owner: Set the fork owner.
230 :param owner: Set the fork owner.
200 :type owner: str
231 :type owner: str
201 :param description: Set the fork description.
232 :param description: Set the fork description.
202 :type description: str
233 :type description: str
203 :param copy_permissions: Copy permissions from parent |repo|. The
234 :param copy_permissions: Copy permissions from parent |repo|. The
204 default is False.
235 default is False.
205 :type copy_permissions: bool
236 :type copy_permissions: bool
206 :param private: Make the fork private. The default is False.
237 :param private: Make the fork private. The default is False.
207 :type private: bool
238 :type private: bool
208 :param landing_rev: Set the landing revision. E.g branch:default, book:dev, rev:abcd
239 :param landing_rev: Set the landing revision. E.g branch:default, book:dev, rev:abcd
209
240
210 Example output:
241 Example output:
211
242
212 .. code-block:: bash
243 .. code-block:: bash
213
244
214 id : <id_for_response>
245 id : <id_for_response>
215 api_key : "<api_key>"
246 api_key : "<api_key>"
216 args: {
247 args: {
217 "repoid" : "<reponame or repo_id>",
248 "repoid" : "<reponame or repo_id>",
218 "fork_name": "<forkname>",
249 "fork_name": "<forkname>",
219 "owner": "<username or user_id = Optional(=apiuser)>",
250 "owner": "<username or user_id = Optional(=apiuser)>",
220 "description": "<description>",
251 "description": "<description>",
221 "copy_permissions": "<bool>",
252 "copy_permissions": "<bool>",
222 "private": "<bool>",
253 "private": "<bool>",
223 "landing_rev": "<landing_rev>"
254 "landing_rev": "<landing_rev>"
224 }
255 }
225
256
226 Example error output:
257 Example error output:
227
258
228 .. code-block:: bash
259 .. code-block:: bash
229
260
230 id : <id_given_in_input>
261 id : <id_given_in_input>
231 result: {
262 result: {
232 "msg": "Created fork of `<reponame>` as `<forkname>`",
263 "msg": "Created fork of `<reponame>` as `<forkname>`",
233 "success": true,
264 "success": true,
234 "task": "<celery task id or None if done sync>"
265 "task": "<celery task id or None if done sync>"
235 }
266 }
236 error: null
267 error: null
237
268
238
269
270 get_comment
271 -----------
272
273 .. py:function:: get_comment(apiuser, comment_id)
274
275 Get single comment from repository or pull_request
276
277 :param apiuser: This is filled automatically from the |authtoken|.
278 :type apiuser: AuthUser
279 :param comment_id: comment id found in the URL of comment
280 :type comment_id: str or int
281
282 Example error output:
283
284 .. code-block:: bash
285
286 {
287 "id" : <id_given_in_input>,
288 "result" : {
289 "comment_author": <USER_DETAILS>,
290 "comment_created_on": "2017-02-01T14:38:16.309",
291 "comment_f_path": "file.txt",
292 "comment_id": 282,
293 "comment_lineno": "n1",
294 "comment_resolved_by": null,
295 "comment_status": [],
296 "comment_text": "This file needs a header",
297 "comment_type": "todo",
298 "comment_last_version: 0
299 },
300 "error" : null
301 }
302
303
239 get_repo
304 get_repo
240 --------
305 --------
241
306
242 .. py:function:: get_repo(apiuser, repoid, cache=<Optional:True>)
307 .. py:function:: get_repo(apiuser, repoid, cache=<Optional:True>)
243
308
244 Gets an existing repository by its name or repository_id.
309 Gets an existing repository by its name or repository_id.
245
310
246 The members section so the output returns users groups or users
311 The members section so the output returns users groups or users
247 associated with that repository.
312 associated with that repository.
248
313
249 This command can only be run using an |authtoken| with admin rights,
314 This command can only be run using an |authtoken| with admin rights,
250 or users with at least read rights to the |repo|.
315 or users with at least read rights to the |repo|.
251
316
252 :param apiuser: This is filled automatically from the |authtoken|.
317 :param apiuser: This is filled automatically from the |authtoken|.
253 :type apiuser: AuthUser
318 :type apiuser: AuthUser
254 :param repoid: The repository name or repository id.
319 :param repoid: The repository name or repository id.
255 :type repoid: str or int
320 :type repoid: str or int
256 :param cache: use the cached value for last changeset
321 :param cache: use the cached value for last changeset
257 :type: cache: Optional(bool)
322 :type: cache: Optional(bool)
258
323
259 Example output:
324 Example output:
260
325
261 .. code-block:: bash
326 .. code-block:: bash
262
327
263 {
328 {
264 "error": null,
329 "error": null,
265 "id": <repo_id>,
330 "id": <repo_id>,
266 "result": {
331 "result": {
267 "clone_uri": null,
332 "clone_uri": null,
268 "created_on": "timestamp",
333 "created_on": "timestamp",
269 "description": "repo description",
334 "description": "repo description",
270 "enable_downloads": false,
335 "enable_downloads": false,
271 "enable_locking": false,
336 "enable_locking": false,
272 "enable_statistics": false,
337 "enable_statistics": false,
273 "followers": [
338 "followers": [
274 {
339 {
275 "active": true,
340 "active": true,
276 "admin": false,
341 "admin": false,
277 "api_key": "****************************************",
342 "api_key": "****************************************",
278 "api_keys": [
343 "api_keys": [
279 "****************************************"
344 "****************************************"
280 ],
345 ],
281 "email": "user@example.com",
346 "email": "user@example.com",
282 "emails": [
347 "emails": [
283 "user@example.com"
348 "user@example.com"
284 ],
349 ],
285 "extern_name": "rhodecode",
350 "extern_name": "rhodecode",
286 "extern_type": "rhodecode",
351 "extern_type": "rhodecode",
287 "firstname": "username",
352 "firstname": "username",
288 "ip_addresses": [],
353 "ip_addresses": [],
289 "language": null,
354 "language": null,
290 "last_login": "2015-09-16T17:16:35.854",
355 "last_login": "2015-09-16T17:16:35.854",
291 "lastname": "surname",
356 "lastname": "surname",
292 "user_id": <user_id>,
357 "user_id": <user_id>,
293 "username": "name"
358 "username": "name"
294 }
359 }
295 ],
360 ],
296 "fork_of": "parent-repo",
361 "fork_of": "parent-repo",
297 "landing_rev": [
362 "landing_rev": [
298 "rev",
363 "rev",
299 "tip"
364 "tip"
300 ],
365 ],
301 "last_changeset": {
366 "last_changeset": {
302 "author": "User <user@example.com>",
367 "author": "User <user@example.com>",
303 "branch": "default",
368 "branch": "default",
304 "date": "timestamp",
369 "date": "timestamp",
305 "message": "last commit message",
370 "message": "last commit message",
306 "parents": [
371 "parents": [
307 {
372 {
308 "raw_id": "commit-id"
373 "raw_id": "commit-id"
309 }
374 }
310 ],
375 ],
311 "raw_id": "commit-id",
376 "raw_id": "commit-id",
312 "revision": <revision number>,
377 "revision": <revision number>,
313 "short_id": "short id"
378 "short_id": "short id"
314 },
379 },
315 "lock_reason": null,
380 "lock_reason": null,
316 "locked_by": null,
381 "locked_by": null,
317 "locked_date": null,
382 "locked_date": null,
318 "owner": "owner-name",
383 "owner": "owner-name",
319 "permissions": [
384 "permissions": [
320 {
385 {
321 "name": "super-admin-name",
386 "name": "super-admin-name",
322 "origin": "super-admin",
387 "origin": "super-admin",
323 "permission": "repository.admin",
388 "permission": "repository.admin",
324 "type": "user"
389 "type": "user"
325 },
390 },
326 {
391 {
327 "name": "owner-name",
392 "name": "owner-name",
328 "origin": "owner",
393 "origin": "owner",
329 "permission": "repository.admin",
394 "permission": "repository.admin",
330 "type": "user"
395 "type": "user"
331 },
396 },
332 {
397 {
333 "name": "user-group-name",
398 "name": "user-group-name",
334 "origin": "permission",
399 "origin": "permission",
335 "permission": "repository.write",
400 "permission": "repository.write",
336 "type": "user_group"
401 "type": "user_group"
337 }
402 }
338 ],
403 ],
339 "private": true,
404 "private": true,
340 "repo_id": 676,
405 "repo_id": 676,
341 "repo_name": "user-group/repo-name",
406 "repo_name": "user-group/repo-name",
342 "repo_type": "hg"
407 "repo_type": "hg"
343 }
408 }
344 }
409 }
345
410
346
411
347 get_repo_changeset
412 get_repo_changeset
348 ------------------
413 ------------------
349
414
350 .. py:function:: get_repo_changeset(apiuser, repoid, revision, details=<Optional:'basic'>)
415 .. py:function:: get_repo_changeset(apiuser, repoid, revision, details=<Optional:'basic'>)
351
416
352 Returns information about a changeset.
417 Returns information about a changeset.
353
418
354 Additionally parameters define the amount of details returned by
419 Additionally parameters define the amount of details returned by
355 this function.
420 this function.
356
421
357 This command can only be run using an |authtoken| with admin rights,
422 This command can only be run using an |authtoken| with admin rights,
358 or users with at least read rights to the |repo|.
423 or users with at least read rights to the |repo|.
359
424
360 :param apiuser: This is filled automatically from the |authtoken|.
425 :param apiuser: This is filled automatically from the |authtoken|.
361 :type apiuser: AuthUser
426 :type apiuser: AuthUser
362 :param repoid: The repository name or repository id
427 :param repoid: The repository name or repository id
363 :type repoid: str or int
428 :type repoid: str or int
364 :param revision: revision for which listing should be done
429 :param revision: revision for which listing should be done
365 :type revision: str
430 :type revision: str
366 :param details: details can be 'basic|extended|full' full gives diff
431 :param details: details can be 'basic|extended|full' full gives diff
367 info details like the diff itself, and number of changed files etc.
432 info details like the diff itself, and number of changed files etc.
368 :type details: Optional(str)
433 :type details: Optional(str)
369
434
370
435
371 get_repo_changesets
436 get_repo_changesets
372 -------------------
437 -------------------
373
438
374 .. py:function:: get_repo_changesets(apiuser, repoid, start_rev, limit, details=<Optional:'basic'>)
439 .. py:function:: get_repo_changesets(apiuser, repoid, start_rev, limit, details=<Optional:'basic'>)
375
440
376 Returns a set of commits limited by the number starting
441 Returns a set of commits limited by the number starting
377 from the `start_rev` option.
442 from the `start_rev` option.
378
443
379 Additional parameters define the amount of details returned by this
444 Additional parameters define the amount of details returned by this
380 function.
445 function.
381
446
382 This command can only be run using an |authtoken| with admin rights,
447 This command can only be run using an |authtoken| with admin rights,
383 or users with at least read rights to |repos|.
448 or users with at least read rights to |repos|.
384
449
385 :param apiuser: This is filled automatically from the |authtoken|.
450 :param apiuser: This is filled automatically from the |authtoken|.
386 :type apiuser: AuthUser
451 :type apiuser: AuthUser
387 :param repoid: The repository name or repository ID.
452 :param repoid: The repository name or repository ID.
388 :type repoid: str or int
453 :type repoid: str or int
389 :param start_rev: The starting revision from where to get changesets.
454 :param start_rev: The starting revision from where to get changesets.
390 :type start_rev: str
455 :type start_rev: str
391 :param limit: Limit the number of commits to this amount
456 :param limit: Limit the number of commits to this amount
392 :type limit: str or int
457 :type limit: str or int
393 :param details: Set the level of detail returned. Valid option are:
458 :param details: Set the level of detail returned. Valid option are:
394 ``basic``, ``extended`` and ``full``.
459 ``basic``, ``extended`` and ``full``.
395 :type details: Optional(str)
460 :type details: Optional(str)
396
461
397 .. note::
462 .. note::
398
463
399 Setting the parameter `details` to the value ``full`` is extensive
464 Setting the parameter `details` to the value ``full`` is extensive
400 and returns details like the diff itself, and the number
465 and returns details like the diff itself, and the number
401 of changed files.
466 of changed files.
402
467
403
468
404 get_repo_comments
469 get_repo_comments
405 -----------------
470 -----------------
406
471
407 .. py:function:: get_repo_comments(apiuser, repoid, commit_id=<Optional:None>, comment_type=<Optional:None>, userid=<Optional:None>)
472 .. py:function:: get_repo_comments(apiuser, repoid, commit_id=<Optional:None>, comment_type=<Optional:None>, userid=<Optional:None>)
408
473
409 Get all comments for a repository
474 Get all comments for a repository
410
475
411 :param apiuser: This is filled automatically from the |authtoken|.
476 :param apiuser: This is filled automatically from the |authtoken|.
412 :type apiuser: AuthUser
477 :type apiuser: AuthUser
413 :param repoid: Set the repository name or repository ID.
478 :param repoid: Set the repository name or repository ID.
414 :type repoid: str or int
479 :type repoid: str or int
415 :param commit_id: Optionally filter the comments by the commit_id
480 :param commit_id: Optionally filter the comments by the commit_id
416 :type commit_id: Optional(str), default: None
481 :type commit_id: Optional(str), default: None
417 :param comment_type: Optionally filter the comments by the comment_type
482 :param comment_type: Optionally filter the comments by the comment_type
418 one of: 'note', 'todo'
483 one of: 'note', 'todo'
419 :type comment_type: Optional(str), default: None
484 :type comment_type: Optional(str), default: None
420 :param userid: Optionally filter the comments by the author of comment
485 :param userid: Optionally filter the comments by the author of comment
421 :type userid: Optional(str or int), Default: None
486 :type userid: Optional(str or int), Default: None
422
487
423 Example error output:
488 Example error output:
424
489
425 .. code-block:: bash
490 .. code-block:: bash
426
491
427 {
492 {
428 "id" : <id_given_in_input>,
493 "id" : <id_given_in_input>,
429 "result" : [
494 "result" : [
430 {
495 {
431 "comment_author": <USER_DETAILS>,
496 "comment_author": <USER_DETAILS>,
432 "comment_created_on": "2017-02-01T14:38:16.309",
497 "comment_created_on": "2017-02-01T14:38:16.309",
433 "comment_f_path": "file.txt",
498 "comment_f_path": "file.txt",
434 "comment_id": 282,
499 "comment_id": 282,
435 "comment_lineno": "n1",
500 "comment_lineno": "n1",
436 "comment_resolved_by": null,
501 "comment_resolved_by": null,
437 "comment_status": [],
502 "comment_status": [],
438 "comment_text": "This file needs a header",
503 "comment_text": "This file needs a header",
439 "comment_type": "todo"
504 "comment_type": "todo",
505 "comment_last_version: 0
440 }
506 }
441 ],
507 ],
442 "error" : null
508 "error" : null
443 }
509 }
444
510
445
511
446 get_repo_file
512 get_repo_file
447 -------------
513 -------------
448
514
449 .. py:function:: get_repo_file(apiuser, repoid, commit_id, file_path, max_file_bytes=<Optional:None>, details=<Optional:'basic'>, cache=<Optional:True>)
515 .. py:function:: get_repo_file(apiuser, repoid, commit_id, file_path, max_file_bytes=<Optional:None>, details=<Optional:'basic'>, cache=<Optional:True>)
450
516
451 Returns a single file from repository at given revision.
517 Returns a single file from repository at given revision.
452
518
453 This command can only be run using an |authtoken| with admin rights,
519 This command can only be run using an |authtoken| with admin rights,
454 or users with at least read rights to |repos|.
520 or users with at least read rights to |repos|.
455
521
456 :param apiuser: This is filled automatically from the |authtoken|.
522 :param apiuser: This is filled automatically from the |authtoken|.
457 :type apiuser: AuthUser
523 :type apiuser: AuthUser
458 :param repoid: The repository name or repository ID.
524 :param repoid: The repository name or repository ID.
459 :type repoid: str or int
525 :type repoid: str or int
460 :param commit_id: The revision for which listing should be done.
526 :param commit_id: The revision for which listing should be done.
461 :type commit_id: str
527 :type commit_id: str
462 :param file_path: The path from which to start displaying.
528 :param file_path: The path from which to start displaying.
463 :type file_path: str
529 :type file_path: str
464 :param details: Returns different set of information about nodes.
530 :param details: Returns different set of information about nodes.
465 The valid options are ``minimal`` ``basic`` and ``full``.
531 The valid options are ``minimal`` ``basic`` and ``full``.
466 :type details: Optional(str)
532 :type details: Optional(str)
467 :param max_file_bytes: Only return file content under this file size bytes
533 :param max_file_bytes: Only return file content under this file size bytes
468 :type max_file_bytes: Optional(int)
534 :type max_file_bytes: Optional(int)
469 :param cache: Use internal caches for fetching files. If disabled fetching
535 :param cache: Use internal caches for fetching files. If disabled fetching
470 files is slower but more memory efficient
536 files is slower but more memory efficient
471 :type cache: Optional(bool)
537 :type cache: Optional(bool)
472
538
473 Example output:
539 Example output:
474
540
475 .. code-block:: bash
541 .. code-block:: bash
476
542
477 id : <id_given_in_input>
543 id : <id_given_in_input>
478 result: {
544 result: {
479 "binary": false,
545 "binary": false,
480 "extension": "py",
546 "extension": "py",
481 "lines": 35,
547 "lines": 35,
482 "content": "....",
548 "content": "....",
483 "md5": "76318336366b0f17ee249e11b0c99c41",
549 "md5": "76318336366b0f17ee249e11b0c99c41",
484 "mimetype": "text/x-python",
550 "mimetype": "text/x-python",
485 "name": "python.py",
551 "name": "python.py",
486 "size": 817,
552 "size": 817,
487 "type": "file",
553 "type": "file",
488 }
554 }
489 error: null
555 error: null
490
556
491
557
492 get_repo_fts_tree
558 get_repo_fts_tree
493 -----------------
559 -----------------
494
560
495 .. py:function:: get_repo_fts_tree(apiuser, repoid, commit_id, root_path)
561 .. py:function:: get_repo_fts_tree(apiuser, repoid, commit_id, root_path)
496
562
497 Returns a list of tree nodes for path at given revision. This api is built
563 Returns a list of tree nodes for path at given revision. This api is built
498 strictly for usage in full text search building, and shouldn't be consumed
564 strictly for usage in full text search building, and shouldn't be consumed
499
565
500 This command can only be run using an |authtoken| with admin rights,
566 This command can only be run using an |authtoken| with admin rights,
501 or users with at least read rights to |repos|.
567 or users with at least read rights to |repos|.
502
568
503
569
504 get_repo_nodes
570 get_repo_nodes
505 --------------
571 --------------
506
572
507 .. py:function:: get_repo_nodes(apiuser, repoid, revision, root_path, ret_type=<Optional:'all'>, details=<Optional:'basic'>, max_file_bytes=<Optional:None>)
573 .. py:function:: get_repo_nodes(apiuser, repoid, revision, root_path, ret_type=<Optional:'all'>, details=<Optional:'basic'>, max_file_bytes=<Optional:None>)
508
574
509 Returns a list of nodes and children in a flat list for a given
575 Returns a list of nodes and children in a flat list for a given
510 path at given revision.
576 path at given revision.
511
577
512 It's possible to specify ret_type to show only `files` or `dirs`.
578 It's possible to specify ret_type to show only `files` or `dirs`.
513
579
514 This command can only be run using an |authtoken| with admin rights,
580 This command can only be run using an |authtoken| with admin rights,
515 or users with at least read rights to |repos|.
581 or users with at least read rights to |repos|.
516
582
517 :param apiuser: This is filled automatically from the |authtoken|.
583 :param apiuser: This is filled automatically from the |authtoken|.
518 :type apiuser: AuthUser
584 :type apiuser: AuthUser
519 :param repoid: The repository name or repository ID.
585 :param repoid: The repository name or repository ID.
520 :type repoid: str or int
586 :type repoid: str or int
521 :param revision: The revision for which listing should be done.
587 :param revision: The revision for which listing should be done.
522 :type revision: str
588 :type revision: str
523 :param root_path: The path from which to start displaying.
589 :param root_path: The path from which to start displaying.
524 :type root_path: str
590 :type root_path: str
525 :param ret_type: Set the return type. Valid options are
591 :param ret_type: Set the return type. Valid options are
526 ``all`` (default), ``files`` and ``dirs``.
592 ``all`` (default), ``files`` and ``dirs``.
527 :type ret_type: Optional(str)
593 :type ret_type: Optional(str)
528 :param details: Returns extended information about nodes, such as
594 :param details: Returns extended information about nodes, such as
529 md5, binary, and or content.
595 md5, binary, and or content.
530 The valid options are ``basic`` and ``full``.
596 The valid options are ``basic`` and ``full``.
531 :type details: Optional(str)
597 :type details: Optional(str)
532 :param max_file_bytes: Only return file content under this file size bytes
598 :param max_file_bytes: Only return file content under this file size bytes
533 :type details: Optional(int)
599 :type details: Optional(int)
534
600
535 Example output:
601 Example output:
536
602
537 .. code-block:: bash
603 .. code-block:: bash
538
604
539 id : <id_given_in_input>
605 id : <id_given_in_input>
540 result: [
606 result: [
541 {
607 {
542 "binary": false,
608 "binary": false,
543 "content": "File line",
609 "content": "File line",
544 "extension": "md",
610 "extension": "md",
545 "lines": 2,
611 "lines": 2,
546 "md5": "059fa5d29b19c0657e384749480f6422",
612 "md5": "059fa5d29b19c0657e384749480f6422",
547 "mimetype": "text/x-minidsrc",
613 "mimetype": "text/x-minidsrc",
548 "name": "file.md",
614 "name": "file.md",
549 "size": 580,
615 "size": 580,
550 "type": "file"
616 "type": "file"
551 },
617 },
552 ...
618 ...
553 ]
619 ]
554 error: null
620 error: null
555
621
556
622
557 get_repo_refs
623 get_repo_refs
558 -------------
624 -------------
559
625
560 .. py:function:: get_repo_refs(apiuser, repoid)
626 .. py:function:: get_repo_refs(apiuser, repoid)
561
627
562 Returns a dictionary of current references. It returns
628 Returns a dictionary of current references. It returns
563 bookmarks, branches, closed_branches, and tags for given repository
629 bookmarks, branches, closed_branches, and tags for given repository
564
630
565 It's possible to specify ret_type to show only `files` or `dirs`.
631 It's possible to specify ret_type to show only `files` or `dirs`.
566
632
567 This command can only be run using an |authtoken| with admin rights,
633 This command can only be run using an |authtoken| with admin rights,
568 or users with at least read rights to |repos|.
634 or users with at least read rights to |repos|.
569
635
570 :param apiuser: This is filled automatically from the |authtoken|.
636 :param apiuser: This is filled automatically from the |authtoken|.
571 :type apiuser: AuthUser
637 :type apiuser: AuthUser
572 :param repoid: The repository name or repository ID.
638 :param repoid: The repository name or repository ID.
573 :type repoid: str or int
639 :type repoid: str or int
574
640
575 Example output:
641 Example output:
576
642
577 .. code-block:: bash
643 .. code-block:: bash
578
644
579 id : <id_given_in_input>
645 id : <id_given_in_input>
580 "result": {
646 "result": {
581 "bookmarks": {
647 "bookmarks": {
582 "dev": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
648 "dev": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
583 "master": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
649 "master": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
584 },
650 },
585 "branches": {
651 "branches": {
586 "default": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
652 "default": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
587 "stable": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
653 "stable": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
588 },
654 },
589 "branches_closed": {},
655 "branches_closed": {},
590 "tags": {
656 "tags": {
591 "tip": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
657 "tip": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
592 "v4.4.0": "1232313f9e6adac5ce5399c2a891dc1e72b79022",
658 "v4.4.0": "1232313f9e6adac5ce5399c2a891dc1e72b79022",
593 "v4.4.1": "cbb9f1d329ae5768379cdec55a62ebdd546c4e27",
659 "v4.4.1": "cbb9f1d329ae5768379cdec55a62ebdd546c4e27",
594 "v4.4.2": "24ffe44a27fcd1c5b6936144e176b9f6dd2f3a17",
660 "v4.4.2": "24ffe44a27fcd1c5b6936144e176b9f6dd2f3a17",
595 }
661 }
596 }
662 }
597 error: null
663 error: null
598
664
599
665
600 get_repo_settings
666 get_repo_settings
601 -----------------
667 -----------------
602
668
603 .. py:function:: get_repo_settings(apiuser, repoid, key=<Optional:None>)
669 .. py:function:: get_repo_settings(apiuser, repoid, key=<Optional:None>)
604
670
605 Returns all settings for a repository. If key is given it only returns the
671 Returns all settings for a repository. If key is given it only returns the
606 setting identified by the key or null.
672 setting identified by the key or null.
607
673
608 :param apiuser: This is filled automatically from the |authtoken|.
674 :param apiuser: This is filled automatically from the |authtoken|.
609 :type apiuser: AuthUser
675 :type apiuser: AuthUser
610 :param repoid: The repository name or repository id.
676 :param repoid: The repository name or repository id.
611 :type repoid: str or int
677 :type repoid: str or int
612 :param key: Key of the setting to return.
678 :param key: Key of the setting to return.
613 :type: key: Optional(str)
679 :type: key: Optional(str)
614
680
615 Example output:
681 Example output:
616
682
617 .. code-block:: bash
683 .. code-block:: bash
618
684
619 {
685 {
620 "error": null,
686 "error": null,
621 "id": 237,
687 "id": 237,
622 "result": {
688 "result": {
623 "extensions_largefiles": true,
689 "extensions_largefiles": true,
624 "extensions_evolve": true,
690 "extensions_evolve": true,
625 "hooks_changegroup_push_logger": true,
691 "hooks_changegroup_push_logger": true,
626 "hooks_changegroup_repo_size": false,
692 "hooks_changegroup_repo_size": false,
627 "hooks_outgoing_pull_logger": true,
693 "hooks_outgoing_pull_logger": true,
628 "phases_publish": "True",
694 "phases_publish": "True",
629 "rhodecode_hg_use_rebase_for_merging": true,
695 "rhodecode_hg_use_rebase_for_merging": true,
630 "rhodecode_pr_merge_enabled": true,
696 "rhodecode_pr_merge_enabled": true,
631 "rhodecode_use_outdated_comments": true
697 "rhodecode_use_outdated_comments": true
632 }
698 }
633 }
699 }
634
700
635
701
636 get_repos
702 get_repos
637 ---------
703 ---------
638
704
639 .. py:function:: get_repos(apiuser, root=<Optional:None>, traverse=<Optional:True>)
705 .. py:function:: get_repos(apiuser, root=<Optional:None>, traverse=<Optional:True>)
640
706
641 Lists all existing repositories.
707 Lists all existing repositories.
642
708
643 This command can only be run using an |authtoken| with admin rights,
709 This command can only be run using an |authtoken| with admin rights,
644 or users with at least read rights to |repos|.
710 or users with at least read rights to |repos|.
645
711
646 :param apiuser: This is filled automatically from the |authtoken|.
712 :param apiuser: This is filled automatically from the |authtoken|.
647 :type apiuser: AuthUser
713 :type apiuser: AuthUser
648 :param root: specify root repository group to fetch repositories.
714 :param root: specify root repository group to fetch repositories.
649 filters the returned repositories to be members of given root group.
715 filters the returned repositories to be members of given root group.
650 :type root: Optional(None)
716 :type root: Optional(None)
651 :param traverse: traverse given root into subrepositories. With this flag
717 :param traverse: traverse given root into subrepositories. With this flag
652 set to False, it will only return top-level repositories from `root`.
718 set to False, it will only return top-level repositories from `root`.
653 if root is empty it will return just top-level repositories.
719 if root is empty it will return just top-level repositories.
654 :type traverse: Optional(True)
720 :type traverse: Optional(True)
655
721
656
722
657 Example output:
723 Example output:
658
724
659 .. code-block:: bash
725 .. code-block:: bash
660
726
661 id : <id_given_in_input>
727 id : <id_given_in_input>
662 result: [
728 result: [
663 {
729 {
664 "repo_id" : "<repo_id>",
730 "repo_id" : "<repo_id>",
665 "repo_name" : "<reponame>"
731 "repo_name" : "<reponame>"
666 "repo_type" : "<repo_type>",
732 "repo_type" : "<repo_type>",
667 "clone_uri" : "<clone_uri>",
733 "clone_uri" : "<clone_uri>",
668 "private": : "<bool>",
734 "private": : "<bool>",
669 "created_on" : "<datetimecreated>",
735 "created_on" : "<datetimecreated>",
670 "description" : "<description>",
736 "description" : "<description>",
671 "landing_rev": "<landing_rev>",
737 "landing_rev": "<landing_rev>",
672 "owner": "<repo_owner>",
738 "owner": "<repo_owner>",
673 "fork_of": "<name_of_fork_parent>",
739 "fork_of": "<name_of_fork_parent>",
674 "enable_downloads": "<bool>",
740 "enable_downloads": "<bool>",
675 "enable_locking": "<bool>",
741 "enable_locking": "<bool>",
676 "enable_statistics": "<bool>",
742 "enable_statistics": "<bool>",
677 },
743 },
678 ...
744 ...
679 ]
745 ]
680 error: null
746 error: null
681
747
682
748
683 grant_user_group_permission
749 grant_user_group_permission
684 ---------------------------
750 ---------------------------
685
751
686 .. py:function:: grant_user_group_permission(apiuser, repoid, usergroupid, perm)
752 .. py:function:: grant_user_group_permission(apiuser, repoid, usergroupid, perm)
687
753
688 Grant permission for a user group on the specified repository,
754 Grant permission for a user group on the specified repository,
689 or update existing permissions.
755 or update existing permissions.
690
756
691 This command can only be run using an |authtoken| with admin
757 This command can only be run using an |authtoken| with admin
692 permissions on the |repo|.
758 permissions on the |repo|.
693
759
694 :param apiuser: This is filled automatically from the |authtoken|.
760 :param apiuser: This is filled automatically from the |authtoken|.
695 :type apiuser: AuthUser
761 :type apiuser: AuthUser
696 :param repoid: Set the repository name or repository ID.
762 :param repoid: Set the repository name or repository ID.
697 :type repoid: str or int
763 :type repoid: str or int
698 :param usergroupid: Specify the ID of the user group.
764 :param usergroupid: Specify the ID of the user group.
699 :type usergroupid: str or int
765 :type usergroupid: str or int
700 :param perm: Set the user group permissions using the following
766 :param perm: Set the user group permissions using the following
701 format: (repository.(none|read|write|admin))
767 format: (repository.(none|read|write|admin))
702 :type perm: str
768 :type perm: str
703
769
704 Example output:
770 Example output:
705
771
706 .. code-block:: bash
772 .. code-block:: bash
707
773
708 id : <id_given_in_input>
774 id : <id_given_in_input>
709 result : {
775 result : {
710 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
776 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
711 "success": true
777 "success": true
712
778
713 }
779 }
714 error : null
780 error : null
715
781
716 Example error output:
782 Example error output:
717
783
718 .. code-block:: bash
784 .. code-block:: bash
719
785
720 id : <id_given_in_input>
786 id : <id_given_in_input>
721 result : null
787 result : null
722 error : {
788 error : {
723 "failed to edit permission for user group: `<usergroup>` in repo `<repo>`'
789 "failed to edit permission for user group: `<usergroup>` in repo `<repo>`'
724 }
790 }
725
791
726
792
727 grant_user_permission
793 grant_user_permission
728 ---------------------
794 ---------------------
729
795
730 .. py:function:: grant_user_permission(apiuser, repoid, userid, perm)
796 .. py:function:: grant_user_permission(apiuser, repoid, userid, perm)
731
797
732 Grant permissions for the specified user on the given repository,
798 Grant permissions for the specified user on the given repository,
733 or update existing permissions if found.
799 or update existing permissions if found.
734
800
735 This command can only be run using an |authtoken| with admin
801 This command can only be run using an |authtoken| with admin
736 permissions on the |repo|.
802 permissions on the |repo|.
737
803
738 :param apiuser: This is filled automatically from the |authtoken|.
804 :param apiuser: This is filled automatically from the |authtoken|.
739 :type apiuser: AuthUser
805 :type apiuser: AuthUser
740 :param repoid: Set the repository name or repository ID.
806 :param repoid: Set the repository name or repository ID.
741 :type repoid: str or int
807 :type repoid: str or int
742 :param userid: Set the user name.
808 :param userid: Set the user name.
743 :type userid: str
809 :type userid: str
744 :param perm: Set the user permissions, using the following format
810 :param perm: Set the user permissions, using the following format
745 ``(repository.(none|read|write|admin))``
811 ``(repository.(none|read|write|admin))``
746 :type perm: str
812 :type perm: str
747
813
748 Example output:
814 Example output:
749
815
750 .. code-block:: bash
816 .. code-block:: bash
751
817
752 id : <id_given_in_input>
818 id : <id_given_in_input>
753 result: {
819 result: {
754 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
820 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
755 "success": true
821 "success": true
756 }
822 }
757 error: null
823 error: null
758
824
759
825
760 invalidate_cache
826 invalidate_cache
761 ----------------
827 ----------------
762
828
763 .. py:function:: invalidate_cache(apiuser, repoid, delete_keys=<Optional:False>)
829 .. py:function:: invalidate_cache(apiuser, repoid, delete_keys=<Optional:False>)
764
830
765 Invalidates the cache for the specified repository.
831 Invalidates the cache for the specified repository.
766
832
767 This command can only be run using an |authtoken| with admin rights to
833 This command can only be run using an |authtoken| with admin rights to
768 the specified repository.
834 the specified repository.
769
835
770 This command takes the following options:
836 This command takes the following options:
771
837
772 :param apiuser: This is filled automatically from |authtoken|.
838 :param apiuser: This is filled automatically from |authtoken|.
773 :type apiuser: AuthUser
839 :type apiuser: AuthUser
774 :param repoid: Sets the repository name or repository ID.
840 :param repoid: Sets the repository name or repository ID.
775 :type repoid: str or int
841 :type repoid: str or int
776 :param delete_keys: This deletes the invalidated keys instead of
842 :param delete_keys: This deletes the invalidated keys instead of
777 just flagging them.
843 just flagging them.
778 :type delete_keys: Optional(``True`` | ``False``)
844 :type delete_keys: Optional(``True`` | ``False``)
779
845
780 Example output:
846 Example output:
781
847
782 .. code-block:: bash
848 .. code-block:: bash
783
849
784 id : <id_given_in_input>
850 id : <id_given_in_input>
785 result : {
851 result : {
786 'msg': Cache for repository `<repository name>` was invalidated,
852 'msg': Cache for repository `<repository name>` was invalidated,
787 'repository': <repository name>
853 'repository': <repository name>
788 }
854 }
789 error : null
855 error : null
790
856
791 Example error output:
857 Example error output:
792
858
793 .. code-block:: bash
859 .. code-block:: bash
794
860
795 id : <id_given_in_input>
861 id : <id_given_in_input>
796 result : null
862 result : null
797 error : {
863 error : {
798 'Error occurred during cache invalidation action'
864 'Error occurred during cache invalidation action'
799 }
865 }
800
866
801
867
802 lock
868 lock
803 ----
869 ----
804
870
805 .. py:function:: lock(apiuser, repoid, locked=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
871 .. py:function:: lock(apiuser, repoid, locked=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
806
872
807 Sets the lock state of the specified |repo| by the given user.
873 Sets the lock state of the specified |repo| by the given user.
808 From more information, see :ref:`repo-locking`.
874 From more information, see :ref:`repo-locking`.
809
875
810 * If the ``userid`` option is not set, the repository is locked to the
876 * If the ``userid`` option is not set, the repository is locked to the
811 user who called the method.
877 user who called the method.
812 * If the ``locked`` parameter is not set, the current lock state of the
878 * If the ``locked`` parameter is not set, the current lock state of the
813 repository is displayed.
879 repository is displayed.
814
880
815 This command can only be run using an |authtoken| with admin rights to
881 This command can only be run using an |authtoken| with admin rights to
816 the specified repository.
882 the specified repository.
817
883
818 This command takes the following options:
884 This command takes the following options:
819
885
820 :param apiuser: This is filled automatically from the |authtoken|.
886 :param apiuser: This is filled automatically from the |authtoken|.
821 :type apiuser: AuthUser
887 :type apiuser: AuthUser
822 :param repoid: Sets the repository name or repository ID.
888 :param repoid: Sets the repository name or repository ID.
823 :type repoid: str or int
889 :type repoid: str or int
824 :param locked: Sets the lock state.
890 :param locked: Sets the lock state.
825 :type locked: Optional(``True`` | ``False``)
891 :type locked: Optional(``True`` | ``False``)
826 :param userid: Set the repository lock to this user.
892 :param userid: Set the repository lock to this user.
827 :type userid: Optional(str or int)
893 :type userid: Optional(str or int)
828
894
829 Example error output:
895 Example error output:
830
896
831 .. code-block:: bash
897 .. code-block:: bash
832
898
833 id : <id_given_in_input>
899 id : <id_given_in_input>
834 result : {
900 result : {
835 'repo': '<reponame>',
901 'repo': '<reponame>',
836 'locked': <bool: lock state>,
902 'locked': <bool: lock state>,
837 'locked_since': <int: lock timestamp>,
903 'locked_since': <int: lock timestamp>,
838 'locked_by': <username of person who made the lock>,
904 'locked_by': <username of person who made the lock>,
839 'lock_reason': <str: reason for locking>,
905 'lock_reason': <str: reason for locking>,
840 'lock_state_changed': <bool: True if lock state has been changed in this request>,
906 'lock_state_changed': <bool: True if lock state has been changed in this request>,
841 'msg': 'Repo `<reponame>` locked by `<username>` on <timestamp>.'
907 'msg': 'Repo `<reponame>` locked by `<username>` on <timestamp>.'
842 or
908 or
843 'msg': 'Repo `<repository name>` not locked.'
909 'msg': 'Repo `<repository name>` not locked.'
844 or
910 or
845 'msg': 'User `<user name>` set lock state for repo `<repository name>` to `<new lock state>`'
911 'msg': 'User `<user name>` set lock state for repo `<repository name>` to `<new lock state>`'
846 }
912 }
847 error : null
913 error : null
848
914
849 Example error output:
915 Example error output:
850
916
851 .. code-block:: bash
917 .. code-block:: bash
852
918
853 id : <id_given_in_input>
919 id : <id_given_in_input>
854 result : null
920 result : null
855 error : {
921 error : {
856 'Error occurred locking repository `<reponame>`'
922 'Error occurred locking repository `<reponame>`'
857 }
923 }
858
924
859
925
860 maintenance
926 maintenance
861 -----------
927 -----------
862
928
863 .. py:function:: maintenance(apiuser, repoid)
929 .. py:function:: maintenance(apiuser, repoid)
864
930
865 Triggers a maintenance on the given repository.
931 Triggers a maintenance on the given repository.
866
932
867 This command can only be run using an |authtoken| with admin
933 This command can only be run using an |authtoken| with admin
868 rights to the specified repository. For more information,
934 rights to the specified repository. For more information,
869 see :ref:`config-token-ref`.
935 see :ref:`config-token-ref`.
870
936
871 This command takes the following options:
937 This command takes the following options:
872
938
873 :param apiuser: This is filled automatically from the |authtoken|.
939 :param apiuser: This is filled automatically from the |authtoken|.
874 :type apiuser: AuthUser
940 :type apiuser: AuthUser
875 :param repoid: The repository name or repository ID.
941 :param repoid: The repository name or repository ID.
876 :type repoid: str or int
942 :type repoid: str or int
877
943
878 Example output:
944 Example output:
879
945
880 .. code-block:: bash
946 .. code-block:: bash
881
947
882 id : <id_given_in_input>
948 id : <id_given_in_input>
883 result : {
949 result : {
884 "msg": "executed maintenance command",
950 "msg": "executed maintenance command",
885 "executed_actions": [
951 "executed_actions": [
886 <action_message>, <action_message2>...
952 <action_message>, <action_message2>...
887 ],
953 ],
888 "repository": "<repository name>"
954 "repository": "<repository name>"
889 }
955 }
890 error : null
956 error : null
891
957
892 Example error output:
958 Example error output:
893
959
894 .. code-block:: bash
960 .. code-block:: bash
895
961
896 id : <id_given_in_input>
962 id : <id_given_in_input>
897 result : null
963 result : null
898 error : {
964 error : {
899 "Unable to execute maintenance on `<reponame>`"
965 "Unable to execute maintenance on `<reponame>`"
900 }
966 }
901
967
902
968
903 pull
969 pull
904 ----
970 ----
905
971
906 .. py:function:: pull(apiuser, repoid, remote_uri=<Optional:None>)
972 .. py:function:: pull(apiuser, repoid, remote_uri=<Optional:None>)
907
973
908 Triggers a pull on the given repository from a remote location. You
974 Triggers a pull on the given repository from a remote location. You
909 can use this to keep remote repositories up-to-date.
975 can use this to keep remote repositories up-to-date.
910
976
911 This command can only be run using an |authtoken| with admin
977 This command can only be run using an |authtoken| with admin
912 rights to the specified repository. For more information,
978 rights to the specified repository. For more information,
913 see :ref:`config-token-ref`.
979 see :ref:`config-token-ref`.
914
980
915 This command takes the following options:
981 This command takes the following options:
916
982
917 :param apiuser: This is filled automatically from the |authtoken|.
983 :param apiuser: This is filled automatically from the |authtoken|.
918 :type apiuser: AuthUser
984 :type apiuser: AuthUser
919 :param repoid: The repository name or repository ID.
985 :param repoid: The repository name or repository ID.
920 :type repoid: str or int
986 :type repoid: str or int
921 :param remote_uri: Optional remote URI to pass in for pull
987 :param remote_uri: Optional remote URI to pass in for pull
922 :type remote_uri: str
988 :type remote_uri: str
923
989
924 Example output:
990 Example output:
925
991
926 .. code-block:: bash
992 .. code-block:: bash
927
993
928 id : <id_given_in_input>
994 id : <id_given_in_input>
929 result : {
995 result : {
930 "msg": "Pulled from url `<remote_url>` on repo `<repository name>`"
996 "msg": "Pulled from url `<remote_url>` on repo `<repository name>`"
931 "repository": "<repository name>"
997 "repository": "<repository name>"
932 }
998 }
933 error : null
999 error : null
934
1000
935 Example error output:
1001 Example error output:
936
1002
937 .. code-block:: bash
1003 .. code-block:: bash
938
1004
939 id : <id_given_in_input>
1005 id : <id_given_in_input>
940 result : null
1006 result : null
941 error : {
1007 error : {
942 "Unable to push changes from `<remote_url>`"
1008 "Unable to push changes from `<remote_url>`"
943 }
1009 }
944
1010
945
1011
946 remove_field_from_repo
1012 remove_field_from_repo
947 ----------------------
1013 ----------------------
948
1014
949 .. py:function:: remove_field_from_repo(apiuser, repoid, key)
1015 .. py:function:: remove_field_from_repo(apiuser, repoid, key)
950
1016
951 Removes an extra field from a repository.
1017 Removes an extra field from a repository.
952
1018
953 This command can only be run using an |authtoken| with at least
1019 This command can only be run using an |authtoken| with at least
954 write permissions to the |repo|.
1020 write permissions to the |repo|.
955
1021
956 :param apiuser: This is filled automatically from the |authtoken|.
1022 :param apiuser: This is filled automatically from the |authtoken|.
957 :type apiuser: AuthUser
1023 :type apiuser: AuthUser
958 :param repoid: Set the repository name or repository ID.
1024 :param repoid: Set the repository name or repository ID.
959 :type repoid: str or int
1025 :type repoid: str or int
960 :param key: Set the unique field key for this repository.
1026 :param key: Set the unique field key for this repository.
961 :type key: str
1027 :type key: str
962
1028
963
1029
964 revoke_user_group_permission
1030 revoke_user_group_permission
965 ----------------------------
1031 ----------------------------
966
1032
967 .. py:function:: revoke_user_group_permission(apiuser, repoid, usergroupid)
1033 .. py:function:: revoke_user_group_permission(apiuser, repoid, usergroupid)
968
1034
969 Revoke the permissions of a user group on a given repository.
1035 Revoke the permissions of a user group on a given repository.
970
1036
971 This command can only be run using an |authtoken| with admin
1037 This command can only be run using an |authtoken| with admin
972 permissions on the |repo|.
1038 permissions on the |repo|.
973
1039
974 :param apiuser: This is filled automatically from the |authtoken|.
1040 :param apiuser: This is filled automatically from the |authtoken|.
975 :type apiuser: AuthUser
1041 :type apiuser: AuthUser
976 :param repoid: Set the repository name or repository ID.
1042 :param repoid: Set the repository name or repository ID.
977 :type repoid: str or int
1043 :type repoid: str or int
978 :param usergroupid: Specify the user group ID.
1044 :param usergroupid: Specify the user group ID.
979 :type usergroupid: str or int
1045 :type usergroupid: str or int
980
1046
981 Example output:
1047 Example output:
982
1048
983 .. code-block:: bash
1049 .. code-block:: bash
984
1050
985 id : <id_given_in_input>
1051 id : <id_given_in_input>
986 result: {
1052 result: {
987 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
1053 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
988 "success": true
1054 "success": true
989 }
1055 }
990 error: null
1056 error: null
991
1057
992
1058
993 revoke_user_permission
1059 revoke_user_permission
994 ----------------------
1060 ----------------------
995
1061
996 .. py:function:: revoke_user_permission(apiuser, repoid, userid)
1062 .. py:function:: revoke_user_permission(apiuser, repoid, userid)
997
1063
998 Revoke permission for a user on the specified repository.
1064 Revoke permission for a user on the specified repository.
999
1065
1000 This command can only be run using an |authtoken| with admin
1066 This command can only be run using an |authtoken| with admin
1001 permissions on the |repo|.
1067 permissions on the |repo|.
1002
1068
1003 :param apiuser: This is filled automatically from the |authtoken|.
1069 :param apiuser: This is filled automatically from the |authtoken|.
1004 :type apiuser: AuthUser
1070 :type apiuser: AuthUser
1005 :param repoid: Set the repository name or repository ID.
1071 :param repoid: Set the repository name or repository ID.
1006 :type repoid: str or int
1072 :type repoid: str or int
1007 :param userid: Set the user name of revoked user.
1073 :param userid: Set the user name of revoked user.
1008 :type userid: str or int
1074 :type userid: str or int
1009
1075
1010 Example error output:
1076 Example error output:
1011
1077
1012 .. code-block:: bash
1078 .. code-block:: bash
1013
1079
1014 id : <id_given_in_input>
1080 id : <id_given_in_input>
1015 result: {
1081 result: {
1016 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
1082 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
1017 "success": true
1083 "success": true
1018 }
1084 }
1019 error: null
1085 error: null
1020
1086
1021
1087
1022 set_repo_settings
1088 set_repo_settings
1023 -----------------
1089 -----------------
1024
1090
1025 .. py:function:: set_repo_settings(apiuser, repoid, settings)
1091 .. py:function:: set_repo_settings(apiuser, repoid, settings)
1026
1092
1027 Update repository settings. Returns true on success.
1093 Update repository settings. Returns true on success.
1028
1094
1029 :param apiuser: This is filled automatically from the |authtoken|.
1095 :param apiuser: This is filled automatically from the |authtoken|.
1030 :type apiuser: AuthUser
1096 :type apiuser: AuthUser
1031 :param repoid: The repository name or repository id.
1097 :param repoid: The repository name or repository id.
1032 :type repoid: str or int
1098 :type repoid: str or int
1033 :param settings: The new settings for the repository.
1099 :param settings: The new settings for the repository.
1034 :type: settings: dict
1100 :type: settings: dict
1035
1101
1036 Example output:
1102 Example output:
1037
1103
1038 .. code-block:: bash
1104 .. code-block:: bash
1039
1105
1040 {
1106 {
1041 "error": null,
1107 "error": null,
1042 "id": 237,
1108 "id": 237,
1043 "result": true
1109 "result": true
1044 }
1110 }
1045
1111
1046
1112
1047 strip
1113 strip
1048 -----
1114 -----
1049
1115
1050 .. py:function:: strip(apiuser, repoid, revision, branch)
1116 .. py:function:: strip(apiuser, repoid, revision, branch)
1051
1117
1052 Strips the given revision from the specified repository.
1118 Strips the given revision from the specified repository.
1053
1119
1054 * This will remove the revision and all of its decendants.
1120 * This will remove the revision and all of its decendants.
1055
1121
1056 This command can only be run using an |authtoken| with admin rights to
1122 This command can only be run using an |authtoken| with admin rights to
1057 the specified repository.
1123 the specified repository.
1058
1124
1059 This command takes the following options:
1125 This command takes the following options:
1060
1126
1061 :param apiuser: This is filled automatically from the |authtoken|.
1127 :param apiuser: This is filled automatically from the |authtoken|.
1062 :type apiuser: AuthUser
1128 :type apiuser: AuthUser
1063 :param repoid: The repository name or repository ID.
1129 :param repoid: The repository name or repository ID.
1064 :type repoid: str or int
1130 :type repoid: str or int
1065 :param revision: The revision you wish to strip.
1131 :param revision: The revision you wish to strip.
1066 :type revision: str
1132 :type revision: str
1067 :param branch: The branch from which to strip the revision.
1133 :param branch: The branch from which to strip the revision.
1068 :type branch: str
1134 :type branch: str
1069
1135
1070 Example output:
1136 Example output:
1071
1137
1072 .. code-block:: bash
1138 .. code-block:: bash
1073
1139
1074 id : <id_given_in_input>
1140 id : <id_given_in_input>
1075 result : {
1141 result : {
1076 "msg": "'Stripped commit <commit_hash> from repo `<repository name>`'"
1142 "msg": "'Stripped commit <commit_hash> from repo `<repository name>`'"
1077 "repository": "<repository name>"
1143 "repository": "<repository name>"
1078 }
1144 }
1079 error : null
1145 error : null
1080
1146
1081 Example error output:
1147 Example error output:
1082
1148
1083 .. code-block:: bash
1149 .. code-block:: bash
1084
1150
1085 id : <id_given_in_input>
1151 id : <id_given_in_input>
1086 result : null
1152 result : null
1087 error : {
1153 error : {
1088 "Unable to strip commit <commit_hash> from repo `<repository name>`"
1154 "Unable to strip commit <commit_hash> from repo `<repository name>`"
1089 }
1155 }
1090
1156
1091
1157
1092 update_repo
1158 update_repo
1093 -----------
1159 -----------
1094
1160
1095 .. py:function:: update_repo(apiuser, repoid, repo_name=<Optional:None>, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:None>, fork_of=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, fields=<Optional:''>)
1161 .. py:function:: update_repo(apiuser, repoid, repo_name=<Optional:None>, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:None>, fork_of=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, fields=<Optional:''>)
1096
1162
1097 Updates a repository with the given information.
1163 Updates a repository with the given information.
1098
1164
1099 This command can only be run using an |authtoken| with at least
1165 This command can only be run using an |authtoken| with at least
1100 admin permissions to the |repo|.
1166 admin permissions to the |repo|.
1101
1167
1102 * If the repository name contains "/", repository will be updated
1168 * If the repository name contains "/", repository will be updated
1103 accordingly with a repository group or nested repository groups
1169 accordingly with a repository group or nested repository groups
1104
1170
1105 For example repoid=repo-test name="foo/bar/repo-test" will update |repo|
1171 For example repoid=repo-test name="foo/bar/repo-test" will update |repo|
1106 called "repo-test" and place it inside group "foo/bar".
1172 called "repo-test" and place it inside group "foo/bar".
1107 You have to have permissions to access and write to the last repository
1173 You have to have permissions to access and write to the last repository
1108 group ("bar" in this example)
1174 group ("bar" in this example)
1109
1175
1110 :param apiuser: This is filled automatically from the |authtoken|.
1176 :param apiuser: This is filled automatically from the |authtoken|.
1111 :type apiuser: AuthUser
1177 :type apiuser: AuthUser
1112 :param repoid: repository name or repository ID.
1178 :param repoid: repository name or repository ID.
1113 :type repoid: str or int
1179 :type repoid: str or int
1114 :param repo_name: Update the |repo| name, including the
1180 :param repo_name: Update the |repo| name, including the
1115 repository group it's in.
1181 repository group it's in.
1116 :type repo_name: str
1182 :type repo_name: str
1117 :param owner: Set the |repo| owner.
1183 :param owner: Set the |repo| owner.
1118 :type owner: str
1184 :type owner: str
1119 :param fork_of: Set the |repo| as fork of another |repo|.
1185 :param fork_of: Set the |repo| as fork of another |repo|.
1120 :type fork_of: str
1186 :type fork_of: str
1121 :param description: Update the |repo| description.
1187 :param description: Update the |repo| description.
1122 :type description: str
1188 :type description: str
1123 :param private: Set the |repo| as private. (True | False)
1189 :param private: Set the |repo| as private. (True | False)
1124 :type private: bool
1190 :type private: bool
1125 :param clone_uri: Update the |repo| clone URI.
1191 :param clone_uri: Update the |repo| clone URI.
1126 :type clone_uri: str
1192 :type clone_uri: str
1127 :param landing_rev: Set the |repo| landing revision. e.g branch:default, book:dev, rev:abcd
1193 :param landing_rev: Set the |repo| landing revision. e.g branch:default, book:dev, rev:abcd
1128 :type landing_rev: str
1194 :type landing_rev: str
1129 :param enable_statistics: Enable statistics on the |repo|, (True | False).
1195 :param enable_statistics: Enable statistics on the |repo|, (True | False).
1130 :type enable_statistics: bool
1196 :type enable_statistics: bool
1131 :param enable_locking: Enable |repo| locking.
1197 :param enable_locking: Enable |repo| locking.
1132 :type enable_locking: bool
1198 :type enable_locking: bool
1133 :param enable_downloads: Enable downloads from the |repo|, (True | False).
1199 :param enable_downloads: Enable downloads from the |repo|, (True | False).
1134 :type enable_downloads: bool
1200 :type enable_downloads: bool
1135 :param fields: Add extra fields to the |repo|. Use the following
1201 :param fields: Add extra fields to the |repo|. Use the following
1136 example format: ``field_key=field_val,field_key2=fieldval2``.
1202 example format: ``field_key=field_val,field_key2=fieldval2``.
1137 Escape ', ' with \,
1203 Escape ', ' with \,
1138 :type fields: str
1204 :type fields: str
1139
1205
1140
1206
General Comments 0
You need to be logged in to leave comments. Login now