Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
648b852e
Commit
648b852e
authored
Feb 09, 2021
by
Jonathan Schafer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add divergedFromTargetBranch to MergeRequestType
Update docs and schema Add tests
parent
7aa7d513
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
1 deletion
+41
-1
app/graphql/types/merge_request_type.rb
app/graphql/types/merge_request_type.rb
+4
-0
changelogs/unreleased/275818-be-add-info-error-messages-to-security-widget-summary-diverged.yml
...fo-error-messages-to-security-widget-summary-diverged.yml
+6
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
spec/graphql/types/merge_request_type_spec.rb
spec/graphql/types/merge_request_type_spec.rb
+30
-1
No files found.
app/graphql/types/merge_request_type.rb
View file @
648b852e
...
...
@@ -108,6 +108,10 @@ module Types
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
,
...
...
changelogs/unreleased/275818-be-add-info-error-messages-to-security-widget-summary-diverged.yml
0 → 100644
View file @
648b852e
---
title
:
Add divergedFromTargetBranch field to MergeRequestType to indicate the target
branch has diverged from the source branch
merge_request
:
53759
author
:
type
:
changed
doc/api/graphql/reference/index.md
View file @
648b852e
...
...
@@ -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. |
...
...
spec/graphql/types/merge_request_type_spec.rb
View file @
648b852e
...
...
@@ -23,7 +23,7 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
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
...
...
@@ -77,4 +77,33 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment