Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-30 03:09:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-30 03:09:36 +0300
commit7dc8250e16dfd900429d42990a5b3da7922e5d36 (patch)
treef88d6fa1e7fff51de09db399cf4b3e34a6c78617
parent6c278c906867ddd58776ed4623a9d8ac1fa41ff6 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--doc/api/merge_requests.md43
-rw-r--r--lib/api/entities/merge_request_basic.rb7
-rw-r--r--spec/lib/api/entities/merge_request_basic_spec.rb16
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml1
-rw-r--r--spec/requests/api/todos_spec.rb2
5 files changed, 56 insertions, 13 deletions
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md
index 4667e48f233..ba4a3292ce8 100644
--- a/doc/api/merge_requests.md
+++ b/doc/api/merge_requests.md
@@ -160,6 +160,7 @@ Supported attributes:
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
@@ -360,6 +361,7 @@ Supported attributes:
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
@@ -547,6 +549,7 @@ Supported attributes:
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
@@ -655,6 +658,7 @@ Supported attributes:
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "can_be_merged",
"sha": "e82eb4a098e32c796079ca3915e07487fc4db24c",
"merge_commit_sha": null,
"squash_commit_sha": null,
@@ -766,12 +770,6 @@ the `approvals_before_merge` parameter:
### Single merge request response notes
-- The `merge_status` field may hold one of the following values:
- - `unchecked`: This merge request has not yet been checked.
- - `checking`: This merge request is currently being checked to see if it can be merged.
- - `can_be_merged`: This merge request can be merged without conflict.
- - `cannot_be_merged`: There are merge conflicts between the source and target branches.
- - `cannot_be_merged_recheck`: Currently unchecked. Before the current changes, there were conflicts.
- The `diff_refs` in the response correspond to the latest diff version of the merge request.
- [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/29984) in GitLab 12.8, the mergeability (`merge_status`)
of each merge request is checked asynchronously when a request is made to this endpoint. Poll this API endpoint
@@ -787,6 +785,31 @@ the `approvals_before_merge` parameter:
- `pipeline` is an old parameter and should not be used. Use `head_pipeline` instead,
as it is faster and returns more information.
+### Merge status
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/101724) in GitLab 15.6.
+
+- The `merge_status` field may hold one of the following values:
+ - `unchecked`: This merge request has not yet been checked.
+ - `checking`: This merge request is currently being checked to see if it can be merged.
+ - `can_be_merged`: This merge request can be merged without conflict.
+ - `cannot_be_merged`: There are merge conflicts between the source and target branches.
+ - `cannot_be_merged_recheck`: Currently unchecked. Before the current changes, there were conflicts.
+- The `detailed_merge_status` field may hold one of the following values:
+ - `blocked_status`: Merge request is blocked by another merge request.
+ - `broken_status`: Can not merge the source into the target branch, potential conflict.
+ - `checking`: currently checking for mergeability.
+ - `ci_must_pass`: Pipeline must succeed before merging.
+ - `ci_still_running`: Pipeline is still running.
+ - `discussions_not_resolved`: Discussions must be resolved before merging.
+ - `draft_status`: Merge request must not be draft before merging.
+ - `external_status_checks`: Status checks must pass.
+ - `mergeable`: branch can be merged.
+ - `not_approved`: Merge request must be approved before merging.
+ - `not_open`: merge request must be open before merging.
+ - `policies_denied`: There are denied policies for the merge request.
+ - `unchecked`: merge status has not been checked.
+
## Get single MR participants
Get a list of merge request participants.
@@ -994,6 +1017,7 @@ Supported attributes:
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "can_be_merged",
"subscribed" : true,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
@@ -1211,6 +1235,7 @@ If `approvals_before_merge` is not provided, it inherits the value from the targ
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"merge_error": null,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
@@ -1392,6 +1417,7 @@ Must include at least one non-required attribute from above.
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"merge_error": null,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
@@ -1580,6 +1606,7 @@ Supported attributes:
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"merge_error": null,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
@@ -1792,6 +1819,7 @@ Supported attributes:
},
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"merge_error": null,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
@@ -2124,6 +2152,7 @@ Example response:
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
@@ -2294,6 +2323,7 @@ Example response:
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
+ "detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
@@ -2479,6 +2509,7 @@ Example response:
},
"merge_when_pipeline_succeeds": false,
"merge_status": "unchecked",
+ "detailed_merge_status": "not_open",
"subscribed": true,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
diff --git a/lib/api/entities/merge_request_basic.rb b/lib/api/entities/merge_request_basic.rb
index 55d58166590..27f6e6ade06 100644
--- a/lib/api/entities/merge_request_basic.rb
+++ b/lib/api/entities/merge_request_basic.rb
@@ -58,6 +58,7 @@ module API
merge_request.check_mergeability(async: true) unless options[:skip_merge_status_recheck]
merge_request.public_merge_status
end
+ expose :detailed_merge_status
expose :diff_head_sha, as: :sha
expose :merge_commit_sha
expose :squash_commit_sha
@@ -93,6 +94,12 @@ module API
expose :task_completion_status
expose :cannot_be_merged?, as: :has_conflicts
expose :mergeable_discussions_state?, as: :blocking_discussions_resolved
+
+ private
+
+ def detailed_merge_status
+ ::MergeRequests::Mergeability::DetailedMergeStatusService.new(merge_request: object).execute
+ end
end
end
end
diff --git a/spec/lib/api/entities/merge_request_basic_spec.rb b/spec/lib/api/entities/merge_request_basic_spec.rb
index 40f259b86e2..bb0e25d2613 100644
--- a/spec/lib/api/entities/merge_request_basic_spec.rb
+++ b/spec/lib/api/entities/merge_request_basic_spec.rb
@@ -18,12 +18,16 @@ RSpec.describe ::API::Entities::MergeRequestBasic do
subject { entity.as_json }
- it 'includes basic fields' do
- is_expected.to include(
- draft: merge_request.draft?,
- work_in_progress: merge_request.draft?,
- merge_user: nil
- )
+ it 'includes expected fields' do
+ expected_fields = %i[
+ merged_by merge_user merged_at closed_by closed_at target_branch user_notes_count upvotes downvotes
+ author assignees assignee reviewers source_project_id target_project_id labels draft work_in_progress
+ milestone merge_when_pipeline_succeeds merge_status detailed_merge_status sha merge_commit_sha
+ squash_commit_sha discussion_locked should_remove_source_branch force_remove_source_branch
+ reference references web_url time_stats squash task_completion_status has_conflicts blocking_discussions_resolved
+ ]
+
+ is_expected.to include(*expected_fields)
end
context "with :with_api_entity_associations scope" do
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 7a0d2596049..c11927150e4 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -540,6 +540,7 @@ project:
- jenkins_integration
- index_status
- feature_usage
+- regular_or_any_approver_approval_rules
- approval_rules
- approval_merge_request_rules
- approval_merge_request_rule_sources
diff --git a/spec/requests/api/todos_spec.rb b/spec/requests/api/todos_spec.rb
index 0fcb6412a2d..7a626ee4d29 100644
--- a/spec/requests/api/todos_spec.rb
+++ b/spec/requests/api/todos_spec.rb
@@ -231,7 +231,7 @@ RSpec.describe API::Todos do
create(:on_commit_todo, project: new_todo.project, author: author_1, user: john_doe, target: merge_request_3)
create(:todo, project: new_todo.project, author: author_2, user: john_doe, target: merge_request_3)
- expect { get api('/todos', john_doe) }.not_to exceed_query_limit(control1).with_threshold(4)
+ expect { get api('/todos', john_doe) }.not_to exceed_query_limit(control1).with_threshold(5)
control2 = ActiveRecord::QueryRecorder.new { get api('/todos', john_doe) }
create_issue_todo_for(john_doe)