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