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
cf4cbb01
Commit
cf4cbb01
authored
Aug 10, 2016
by
Douwe Maan
Committed by
Fatih Acet
Aug 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `can_resolve_conflicts_in_ui?` to `conflicts_can_be_resolved_in_ui?`
parent
79274844
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
15 deletions
+17
-15
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+7
-5
app/views/projects/merge_requests/widget/open/_conflicts.html.haml
.../projects/merge_requests/widget/open/_conflicts.html.haml
+1
-1
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+8
-8
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
cf4cbb01
...
...
@@ -135,7 +135,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
format
.
html
{
define_discussion_vars
}
format
.
json
do
if
@merge_request
.
c
an_resolve_conflicts
_in_ui?
if
@merge_request
.
c
onflicts_can_be_resolved
_in_ui?
render
json:
@merge_request
.
conflicts
else
render
json:
{
...
...
app/models/merge_request.rb
View file @
cf4cbb01
...
...
@@ -720,14 +720,16 @@ class MergeRequest < ActiveRecord::Base
@conflicts
||=
Gitlab
::
Conflict
::
FileCollection
.
new
(
self
)
end
def
can_resolve_conflicts_in_ui?
return
false
unless
cannot_be_merged?
return
false
unless
has_complete_diff_refs?
def
conflicts_can_be_resolved_in_ui?
return
@conflicts_can_be_resolved_in_ui
if
defined?
(
@conflicts_can_be_resolved_in_ui
)
return
@conflicts_can_be_resolved_in_ui
=
false
unless
cannot_be_merged?
return
@conflicts_can_be_resolved_in_ui
=
false
unless
has_complete_diff_refs?
begin
conflicts
.
files
.
each
(
&
:lines
)
@conflicts_can_be_resolved_in_ui
=
conflicts
.
files
.
each
(
&
:lines
)
rescue
Gitlab
::
Conflict
::
Parser
::
ParserError
,
Gitlab
::
Conflict
::
FileCollection
::
ConflictSideMissing
false
@conflicts_can_be_resolved_in_ui
=
false
end
end
end
app/views/projects/merge_requests/widget/open/_conflicts.html.haml
View file @
cf4cbb01
...
...
@@ -4,7 +4,7 @@
%p
Please
-
if
@merge_request
.
c
an_resolve_conflicts
_in_ui?
-
if
@merge_request
.
c
onflicts_can_be_resolved
_in_ui?
=
link_to
"resolve these conflicts"
,
conflicts_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
or
-
if
@merge_request
.
can_be_merged_via_command_line_by?
(
current_user
)
...
...
spec/models/merge_request_spec.rb
View file @
cf4cbb01
...
...
@@ -742,7 +742,7 @@ describe MergeRequest, models: true do
end
end
describe
'#c
an_resolve_conflicts
_in_ui?'
do
describe
'#c
onflicts_can_be_resolved
_in_ui?'
do
def
create_merge_request
(
source_branch
)
create
(
:merge_request
,
source_branch:
source_branch
,
target_branch:
'conflict-start'
)
do
|
mr
|
mr
.
mark_as_unmergeable
...
...
@@ -753,44 +753,44 @@ describe MergeRequest, models: true do
merge_request
=
create_merge_request
(
'master'
)
merge_request
.
mark_as_mergeable
expect
(
merge_request
.
c
an_resolve_conflicts
_in_ui?
).
to
be_falsey
expect
(
merge_request
.
c
onflicts_can_be_resolved
_in_ui?
).
to
be_falsey
end
it
'returns a falsey value when the MR does not support new diff notes'
do
merge_request
=
create_merge_request
(
'conflict-resolvable'
)
merge_request
.
merge_request_diff
.
update_attributes
(
start_commit_sha:
nil
)
expect
(
merge_request
.
c
an_resolve_conflicts
_in_ui?
).
to
be_falsey
expect
(
merge_request
.
c
onflicts_can_be_resolved
_in_ui?
).
to
be_falsey
end
it
'returns a falsey value when the conflicts contain a large file'
do
merge_request
=
create_merge_request
(
'conflict-too-large'
)
expect
(
merge_request
.
c
an_resolve_conflicts
_in_ui?
).
to
be_falsey
expect
(
merge_request
.
c
onflicts_can_be_resolved
_in_ui?
).
to
be_falsey
end
it
'returns a falsey value when the conflicts contain a binary file'
do
merge_request
=
create_merge_request
(
'conflict-binary-file'
)
expect
(
merge_request
.
c
an_resolve_conflicts
_in_ui?
).
to
be_falsey
expect
(
merge_request
.
c
onflicts_can_be_resolved
_in_ui?
).
to
be_falsey
end
it
'returns a falsey value when the conflicts contain a file with ambiguous conflict markers'
do
merge_request
=
create_merge_request
(
'conflict-contains-conflict-markers'
)
expect
(
merge_request
.
c
an_resolve_conflicts
_in_ui?
).
to
be_falsey
expect
(
merge_request
.
c
onflicts_can_be_resolved
_in_ui?
).
to
be_falsey
end
it
'returns a falsey value when the conflicts contain a file edited in one branch and deleted in another'
do
merge_request
=
create_merge_request
(
'conflict-missing-side'
)
expect
(
merge_request
.
c
an_resolve_conflicts
_in_ui?
).
to
be_falsey
expect
(
merge_request
.
c
onflicts_can_be_resolved
_in_ui?
).
to
be_falsey
end
it
'returns a truthy value when the conflicts are resolvable in the UI'
do
merge_request
=
create_merge_request
(
'conflict-resolvable'
)
expect
(
merge_request
.
c
an_resolve_conflicts
_in_ui?
).
to
be_truthy
expect
(
merge_request
.
c
onflicts_can_be_resolved
_in_ui?
).
to
be_truthy
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