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
4a31c677
Commit
4a31c677
authored
Jan 18, 2018
by
Akos Gyimesi
Committed by
Nick Thomas
Dec 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Link to conflicting MR in reopening error message
Also, the error message became shorter.
parent
5fd5dad4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+8
-3
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+1
-1
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
4a31c677
...
@@ -7,6 +7,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
...
@@ -7,6 +7,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
include
RendersCommits
include
RendersCommits
include
ToggleAwardEmoji
include
ToggleAwardEmoji
include
IssuableCollections
include
IssuableCollections
include
MarkupHelper
skip_before_action
:merge_request
,
only:
[
:index
,
:bulk_update
]
skip_before_action
:merge_request
,
only:
[
:index
,
:bulk_update
]
before_action
:whitelist_query_limiting
,
only:
[
:assign_related_issues
,
:update
]
before_action
:whitelist_query_limiting
,
only:
[
:assign_related_issues
,
:update
]
...
@@ -122,9 +123,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
...
@@ -122,9 +123,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
if
merge_request_params
[
:state_event
]
&&
@merge_request
.
errors
.
any?
check_branch_conflict
flash
[
:alert
]
=
@merge_request
.
errors
.
values
.
flatten
.
to_sentence
end
if
@merge_request
.
valid?
if
@merge_request
.
valid?
redirect_to
([
@merge_request
.
target_project
.
namespace
.
becomes
(
Namespace
),
@merge_request
.
target_project
,
@merge_request
])
redirect_to
([
@merge_request
.
target_project
.
namespace
.
becomes
(
Namespace
),
@merge_request
.
target_project
,
@merge_request
])
...
@@ -259,6 +258,12 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
...
@@ -259,6 +258,12 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
@merge_request
.
check_if_can_be_merged
@merge_request
.
check_if_can_be_merged
end
end
def
check_branch_conflict
if
@merge_request
.
errors
[
:validate_branches
]
flash
[
:alert
]
=
markdown
(
@merge_request
.
errors
[
:validate_branches
].
to_sentence
,
pipeline: :single_line
)
end
end
def
merge!
def
merge!
# Disable the CI check if merge_when_pipeline_succeeds is enabled since we have
# Disable the CI check if merge_when_pipeline_succeeds is enabled since we have
# to wait until CI completes to know
# to wait until CI completes to know
...
...
app/models/merge_request.rb
View file @
4a31c677
...
@@ -547,7 +547,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -547,7 +547,7 @@ class MergeRequest < ActiveRecord::Base
similar_mrs
=
similar_mrs
.
where
(
'id not in (?)'
,
self
.
id
)
if
self
.
id
similar_mrs
=
similar_mrs
.
where
(
'id not in (?)'
,
self
.
id
)
if
self
.
id
if
similar_mrs
.
any?
if
similar_mrs
.
any?
errors
.
add
:validate_branches
,
errors
.
add
:validate_branches
,
"
Cannot open this Merge Request because another open Merge Request already exists for this source branch:
#{
similar_mrs
.
first
.
title
}
"
"
Another open Merge Request already exists for this source branch: !
#{
similar_mrs
.
first
.
id
}
"
end
end
end
end
end
end
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
4a31c677
...
@@ -298,7 +298,7 @@ describe Projects::MergeRequestsController do
...
@@ -298,7 +298,7 @@ describe Projects::MergeRequestsController do
update_merge_request
(
state_event:
'reopen'
)
update_merge_request
(
state_event:
'reopen'
)
expect
(
controller
).
to
set_flash
[
:alert
].
to
(
/
a
nother open Merge Request already exists for this source branch/
)
expect
(
controller
).
to
set_flash
[
:alert
].
to
(
/
A
nother open Merge Request already exists for this source branch/
)
expect
(
merge_request
.
reload
).
to
be_closed
expect
(
merge_request
.
reload
).
to
be_closed
end
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