Skip to content
Snippets Groups Projects
Commit 648b852e authored by Jonathan Schafer's avatar Jonathan Schafer
Browse files

Add divergedFromTargetBranch to MergeRequestType

Update docs and schema
Add tests
parent 7aa7d513
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -108,6 +108,10 @@ class MergeRequestType < BaseObject
null: false, calls_gitaly: true,
method: :target_branch_exists?,
description: 'Indicates if the target branch of the merge request exists.'
field :diverged_from_target_branch, GraphQL::BOOLEAN_TYPE,
null: false, calls_gitaly: true,
method: :diverged_from_target_branch?,
description: 'Indicates if the source branch is behind the target branch.'
field :mergeable_discussions_state, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.'
field :web_url, GraphQL::STRING_TYPE, null: true,
Loading
Loading
---
title: Add divergedFromTargetBranch field to MergeRequestType to indicate the target
branch has diverged from the source branch
merge_request: 53759
author:
type: changed
Loading
Loading
@@ -2473,6 +2473,7 @@ Autogenerated return type of MarkAsSpamSnippet.
| `diffStatsSummary` | DiffStatsSummary | Summary of which files were changed in this merge request. |
| `discussionLocked` | Boolean! | Indicates if comments on the merge request are locked to members only. |
| `discussions` | DiscussionConnection! | All discussions on this noteable. |
| `divergedFromTargetBranch` | Boolean! | Indicates if the source branch is behind the target branch. |
| `downvotes` | Int! | Number of downvotes for the merge request. |
| `forceRemoveSourceBranch` | Boolean | Indicates if the project settings will lead to source branch deletion after merge. |
| `hasCi` | Boolean! | Indicates if the merge request has CI. |
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@
merge_error allow_collaboration should_be_rebased rebase_commit_sha
rebase_in_progress default_merge_commit_message
merge_ongoing mergeable_discussions_state web_url
source_branch_exists target_branch_exists
source_branch_exists target_branch_exists diverged_from_target_branch
upvotes downvotes head_pipeline pipelines task_completion_status
milestone assignees reviewers participants subscribed labels discussion_locked time_estimate
total_time_spent reference author merged_at commit_count current_user_todos
Loading
Loading
@@ -77,4 +77,33 @@
end
end
end
describe '#diverged_from_target_branch' do
subject(:execute_query) { GitlabSchema.execute(query, context: { current_user: current_user }).as_json }
let!(:merge_request) { create(:merge_request, target_project: project, source_project: project) }
let(:project) { create(:project, :public) }
let(:current_user) { create :admin }
let(:query) do
%(
{
project(fullPath: "#{project.full_path}") {
mergeRequests {
nodes {
divergedFromTargetBranch
}
}
}
}
)
end
it 'delegates the diverged_from_target_branch? call to the merge request entity' do
expect_next_found_instance_of(MergeRequest) do |instance|
expect(instance).to receive(:diverged_from_target_branch?)
end
execute_query
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment