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