From 9d259c2232a7a6bab344b961ef8dc9561c380c29 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 3 Nov 2017 13:49:37 +0000 Subject: Add changes_count to the merge requests API This returns the `real_size` of the MR's diff, which is a string indicating the number of changes. If the diff overflows after _n_ files, the string will be `$n+`. --- doc/api/merge_requests.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 50a971102fb..6de460f2778 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -15,6 +15,11 @@ given state (`opened`, `closed`, or `merged`) or all of them (`all`). The pagination parameters `page` and `per_page` can be used to restrict the list of merge requests. +**Note**: the `changes_count` value in the response is a string, not an +integer. This is because when an MR has too many changes to display and store, +it will be capped at 1,000. In that case, the API will return the string +`"1000+"` for the changes count. + ``` GET /merge_requests GET /merge_requests?state=opened @@ -92,6 +97,7 @@ Parameters: "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": null, "user_notes_count": 1, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1", @@ -130,6 +136,11 @@ will be the same. In the case of a merge request from a fork, `target_project_id` and `project_id` will be the same and `source_project_id` will be the fork project's ID. +**Note**: the `changes_count` value in the response is a string, not an +integer. This is because when an MR has too many changes to display and store, +it will be capped at 1,000. In that case, the API will return the string +`"1000+"` for the changes count. + Parameters: | Attribute | Type | Required | Description | @@ -198,6 +209,7 @@ Parameters: "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": null, "user_notes_count": 1, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1", @@ -274,6 +286,7 @@ Parameters: "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": "9999999999999999999999999999999999999999", "user_notes_count": 1, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1", @@ -386,6 +399,7 @@ Parameters: "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": null, "user_notes_count": 1, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1", @@ -480,6 +494,7 @@ POST /projects/:id/merge_requests "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": null, "user_notes_count": 0, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1", @@ -565,6 +580,7 @@ Must include at least one non-required attribute from above. "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": null, "user_notes_count": 1, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1", @@ -670,6 +686,7 @@ Parameters: "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": "9999999999999999999999999999999999999999", "user_notes_count": 1, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1", @@ -747,6 +764,7 @@ Parameters: "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": null, "user_notes_count": 1, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1", @@ -822,7 +840,8 @@ Example response when the GitLab issue tracker is used: "created_at" : "2016-01-04T15:31:51.081Z", "iid" : 6, "labels" : [], - "user_notes_count": 1 + "user_notes_count": 1, + "changes_count": "1" }, ] ``` @@ -1077,6 +1096,7 @@ Example response: "sha": "8888888888888888888888888888888888888888", "merge_commit_sha": null, "user_notes_count": 7, + "changes_count": "1", "should_remove_source_branch": true, "force_remove_source_branch": false, "web_url": "http://example.com/example/example/merge_requests/1" -- cgit v1.2.1 From 6902848a9c54f9eb1bfd82fe173ad0d5d62fe2d5 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Mon, 18 Sep 2017 15:03:24 +0200 Subject: Support custom attributes on projects --- doc/api/custom_attributes.md | 22 ++++++++++++++-------- doc/api/projects.md | 6 ++++++ 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'doc') diff --git a/doc/api/custom_attributes.md b/doc/api/custom_attributes.md index 8b26f7093ab..705f1d401cf 100644 --- a/doc/api/custom_attributes.md +++ b/doc/api/custom_attributes.md @@ -1,18 +1,21 @@ # Custom Attributes API Every API call to custom attributes must be authenticated as administrator. +Custom attributes are currently available on users and projects, which will +be referred to as "resource" in this documentation. ## List custom attributes -Get all custom attributes on a user. +Get all custom attributes on a resource. ``` GET /users/:id/custom_attributes +GET /projects/:id/custom_attributes ``` | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | integer | yes | The ID of a user | +| `id` | integer | yes | The ID of a resource | ```bash curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/users/42/custom_attributes @@ -35,15 +38,16 @@ Example response: ## Single custom attribute -Get a single custom attribute on a user. +Get a single custom attribute on a resource. ``` GET /users/:id/custom_attributes/:key +GET /projects/:id/custom_attributes/:key ``` | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | integer | yes | The ID of a user | +| `id` | integer | yes | The ID of a resource | | `key` | string | yes | The key of the custom attribute | ```bash @@ -61,16 +65,17 @@ Example response: ## Set custom attribute -Set a custom attribute on a user. The attribute will be updated if it already exists, +Set a custom attribute on a resource. The attribute will be updated if it already exists, or newly created otherwise. ``` PUT /users/:id/custom_attributes/:key +PUT /projects/:id/custom_attributes/:key ``` | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | integer | yes | The ID of a user | +| `id` | integer | yes | The ID of a resource | | `key` | string | yes | The key of the custom attribute | | `value` | string | yes | The value of the custom attribute | @@ -89,15 +94,16 @@ Example response: ## Delete custom attribute -Delete a custom attribute on a user. +Delete a custom attribute on a resource. ``` DELETE /users/:id/custom_attributes/:key +DELETE /projects/:id/custom_attributes/:key ``` | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | integer | yes | The ID of a user | +| `id` | integer | yes | The ID of a resource | | `key` | string | yes | The key of the custom attribute | ```bash diff --git a/doc/api/projects.md b/doc/api/projects.md index 07331d05231..5a403f7593a 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -192,6 +192,12 @@ GET /projects ] ``` +You can filter by [custom attributes](custom_attributes.md) with: + +``` +GET /projects?custom_attributes[key]=value&custom_attributes[other_key]=other_value +``` + ## List user projects Get a list of visible projects for the given user. When accessed without -- cgit v1.2.1 From 1f773a8ef5a1f76166d0455c6a5e473278885c17 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Mon, 18 Sep 2017 17:07:38 +0200 Subject: Support custom attributes on groups --- doc/api/custom_attributes.md | 9 +++++++-- doc/api/groups.md | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/api/custom_attributes.md b/doc/api/custom_attributes.md index 705f1d401cf..91d1b0e1520 100644 --- a/doc/api/custom_attributes.md +++ b/doc/api/custom_attributes.md @@ -1,8 +1,9 @@ # Custom Attributes API Every API call to custom attributes must be authenticated as administrator. -Custom attributes are currently available on users and projects, which will -be referred to as "resource" in this documentation. + +Custom attributes are currently available on users, groups, and projects, +which will be referred to as "resource" in this documentation. ## List custom attributes @@ -10,6 +11,7 @@ Get all custom attributes on a resource. ``` GET /users/:id/custom_attributes +GET /groups/:id/custom_attributes GET /projects/:id/custom_attributes ``` @@ -42,6 +44,7 @@ Get a single custom attribute on a resource. ``` GET /users/:id/custom_attributes/:key +GET /groups/:id/custom_attributes/:key GET /projects/:id/custom_attributes/:key ``` @@ -70,6 +73,7 @@ or newly created otherwise. ``` PUT /users/:id/custom_attributes/:key +PUT /groups/:id/custom_attributes/:key PUT /projects/:id/custom_attributes/:key ``` @@ -98,6 +102,7 @@ Delete a custom attribute on a resource. ``` DELETE /users/:id/custom_attributes/:key +DELETE /groups/:id/custom_attributes/:key DELETE /projects/:id/custom_attributes/:key ``` diff --git a/doc/api/groups.md b/doc/api/groups.md index 99d200c9c93..16db9c2f259 100644 --- a/doc/api/groups.md +++ b/doc/api/groups.md @@ -74,6 +74,12 @@ GET /groups?statistics=true You can search for groups by name or path, see below. +You can filter by [custom attributes](custom_attributes.md) with: + +``` +GET /groups?custom_attributes[key]=value&custom_attributes[other_key]=other_value +``` + ## List a group's projects Get a list of projects in this group. When accessed without authentication, only -- cgit v1.2.1 From 12dbf5555373863e397a51a51957632054b58073 Mon Sep 17 00:00:00 2001 From: Victor Wu Date: Tue, 7 Nov 2017 09:12:14 +0000 Subject: Label priority and Priority sort orders --- doc/user/project/img/label_priority_sort_order.png | Bin 0 -> 101667 bytes doc/user/project/img/labels_filter_by_priority.png | Bin 38717 -> 0 bytes doc/user/project/img/priority_sort_order.png | Bin 0 -> 102242 bytes doc/user/project/labels.md | 29 ++++++++++++++++----- 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 doc/user/project/img/label_priority_sort_order.png delete mode 100644 doc/user/project/img/labels_filter_by_priority.png create mode 100644 doc/user/project/img/priority_sort_order.png (limited to 'doc') diff --git a/doc/user/project/img/label_priority_sort_order.png b/doc/user/project/img/label_priority_sort_order.png new file mode 100644 index 00000000000..21c7a76a322 Binary files /dev/null and b/doc/user/project/img/label_priority_sort_order.png differ diff --git a/doc/user/project/img/labels_filter_by_priority.png b/doc/user/project/img/labels_filter_by_priority.png deleted file mode 100644 index 419e555e709..00000000000 Binary files a/doc/user/project/img/labels_filter_by_priority.png and /dev/null differ diff --git a/doc/user/project/img/priority_sort_order.png b/doc/user/project/img/priority_sort_order.png new file mode 100644 index 00000000000..c558ec23b0e Binary files /dev/null and b/doc/user/project/img/priority_sort_order.png differ diff --git a/doc/user/project/labels.md b/doc/user/project/labels.md index 21a2e1213ec..d7eb4bca89c 100644 --- a/doc/user/project/labels.md +++ b/doc/user/project/labels.md @@ -77,15 +77,32 @@ having their priority set to null. ![Prioritize labels](img/labels_prioritize.png) -Now that you have labels prioritized, you can use the 'Priority' and 'Label -priority' filters in the issues or merge requests tracker. +Now that you have labels prioritized, you can use the 'Label priority' and 'Priority' +sort orders in the issues or merge requests tracker. -The 'Label priority' filter puts issues with the highest priority label on top. +In the following, everything applies to both issues and merge requests, but we'll +refer to just issues for brevity. -The 'Priority' filter sorts issues by their soonest milestone due date, then by -label priority. +The 'Label priority' sort order positions issues with higher priority labels +toward the top, and issues with lower priority labels toward the bottom. A non-prioritized +label is considered to have the lowest priority. For a given issue, we _only_ consider the +highest priority label assigned to it in the comparison. ([We are discussing](https://gitlab.com/gitlab-org/gitlab-ce/issues/18554) +including all the labels in a given issue for this comparison.) Given two issues +are equal according to this sort comparison, their relative order is equal, and +therefore it's not guaranteed that one will be always above the other. + +![Label priority sort order](img/label_priority_sort_order.png) + +The 'Priority' sort order comparison first considers an issue's milestone's due date, +(if the issue is assigned a milestone and the milestone's due date exists), and then +secondarily considers the label priority comparison above. Sooner due dates results +a higher sort order. If an issue doesn't have a milestone due date, it is equivalent to +being assigned to a milestone that has a due date in the infinite future. Given two issues +are equal according to this two-stage sort comparison, their relative order is equal, and +therefore it's not guaranteed that one will be always above the other. + +![Priority sort order](img/priority_sort_order.png) -![Filter labels by priority](img/labels_filter_by_priority.png) ## Subscribe to labels -- cgit v1.2.1