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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
439e3f07
Commit
439e3f07
authored
Sep 29, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port semi-linear merge strategy to CE (mostly FE)
parent
dbfe8597
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
3 deletions
+36
-3
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js
...e_request_widget/components/states/mr_widget_conflicts.js
+1
-1
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+8
-0
app/serializers/merge_request_entity.rb
app/serializers/merge_request_entity.rb
+1
-0
app/views/projects/_merge_request_rebase_settings.html.haml
app/views/projects/_merge_request_rebase_settings.html.haml
+13
-0
app/views/projects/_merge_request_settings.html.haml
app/views/projects/_merge_request_settings.html.haml
+2
-0
spec/features/projects/project_settings_spec.rb
spec/features/projects/project_settings_spec.rb
+8
-0
spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
...e_mr_widget/components/states/mr_widget_conflicts_spec.js
+2
-2
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js
View file @
439e3f07
...
@@ -15,7 +15,7 @@ export default {
...
@@ -15,7 +15,7 @@ export default {
showDisabledButton />
showDisabledButton />
<div class="media-body space-children">
<div class="media-body space-children">
<span
<span
v-if="mr.
ffOnlyEnabl
ed"
v-if="mr.
shouldBeRebas
ed"
class="bold">
class="bold">
Fast-forward merge is not possible.
Fast-forward merge is not possible.
To merge this request, first rebase locally.
To merge this request, first rebase locally.
...
...
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
439e3f07
...
@@ -58,6 +58,7 @@ export default class MergeRequestStore {
...
@@ -58,6 +58,7 @@ export default class MergeRequestStore {
this
.
mergeWhenPipelineSucceeds
=
data
.
merge_when_pipeline_succeeds
||
false
;
this
.
mergeWhenPipelineSucceeds
=
data
.
merge_when_pipeline_succeeds
||
false
;
this
.
mergePath
=
data
.
merge_path
;
this
.
mergePath
=
data
.
merge_path
;
this
.
ffOnlyEnabled
=
data
.
ff_only_enabled
;
this
.
ffOnlyEnabled
=
data
.
ff_only_enabled
;
this
.
shouldBeRebased
=
!!
data
.
should_be_rebased
;
this
.
statusPath
=
data
.
status_path
;
this
.
statusPath
=
data
.
status_path
;
this
.
emailPatchesPath
=
data
.
email_patches_path
;
this
.
emailPatchesPath
=
data
.
email_patches_path
;
this
.
plainDiffPath
=
data
.
plain_diff_path
;
this
.
plainDiffPath
=
data
.
plain_diff_path
;
...
...
app/models/merge_request.rb
View file @
439e3f07
...
@@ -524,6 +524,14 @@ class MergeRequest < ActiveRecord::Base
...
@@ -524,6 +524,14 @@ class MergeRequest < ActiveRecord::Base
true
true
end
end
def
ff_merge_possible?
project
.
repository
.
ancestor?
(
target_branch_sha
,
diff_head_sha
)
end
def
should_be_rebased?
project
.
ff_merge_must_be_possible?
&&
!
ff_merge_possible?
end
def
can_cancel_merge_when_pipeline_succeeds?
(
current_user
)
def
can_cancel_merge_when_pipeline_succeeds?
(
current_user
)
can_be_merged_by?
(
current_user
)
||
self
.
author
==
current_user
can_be_merged_by?
(
current_user
)
||
self
.
author
==
current_user
end
end
...
...
app/serializers/merge_request_entity.rb
View file @
439e3f07
...
@@ -13,6 +13,7 @@ class MergeRequestEntity < IssuableEntity
...
@@ -13,6 +13,7 @@ class MergeRequestEntity < IssuableEntity
expose
:target_branch
expose
:target_branch
expose
:target_project_id
expose
:target_project_id
expose
:should_be_rebased?
,
as: :should_be_rebased
expose
:ff_only_enabled
do
|
merge_request
|
expose
:ff_only_enabled
do
|
merge_request
|
merge_request
.
project
.
merge_requests_ff_only_enabled
merge_request
.
project
.
merge_requests_ff_only_enabled
end
end
...
...
app/views/projects/_merge_request_rebase_settings.html.haml
0 → 100644
View file @
439e3f07
-
form
=
local_assigns
.
fetch
(
:form
)
.radio
=
label_tag
:project_merge_method_rebase_merge
do
=
form
.
radio_button
:merge_method
,
:rebase_merge
,
class:
"js-merge-method-radio"
%strong
Merge commit with semi-linear history
%br
%span
.descr
A merge commit is created for every merge, but merging is only allowed if fast-forward merge is possible.
This way you could make sure that if this merge request would build, after merging to target branch it would also build.
%br
%span
.descr
When fast-forward merge is not possible, the user must first rebase locally.
app/views/projects/_merge_request_settings.html.haml
View file @
439e3f07
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
%span
.descr
%span
.descr
A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.
A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.
=
render
'merge_request_rebase_settings'
,
form:
form
=
render
'merge_request_fast_forward_settings'
,
project:
@project
,
form:
form
=
render
'merge_request_fast_forward_settings'
,
project:
@project
,
form:
form
=
render
'projects/merge_request_merge_settings'
,
form:
form
=
render
'projects/merge_request_merge_settings'
,
form:
form
spec/features/projects/project_settings_spec.rb
View file @
439e3f07
...
@@ -41,6 +41,14 @@ describe 'Edit Project Settings' do
...
@@ -41,6 +41,14 @@ describe 'Edit Project Settings' do
end
end
end
end
it
'shows "Merge commit with semi-linear history " strategy'
do
visit
edit_project_path
(
project
)
page
.
within
'.merge-requests-feature'
do
expect
(
page
).
to
have_content
'Merge commit with semi-linear history'
end
end
it
'shows "Fast-forward merge" strategy'
do
it
'shows "Fast-forward merge" strategy'
do
visit
edit_project_path
(
project
)
visit
edit_project_path
(
project
)
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
View file @
439e3f07
...
@@ -81,13 +81,13 @@ describe('MRWidgetConflicts', () => {
...
@@ -81,13 +81,13 @@ describe('MRWidgetConflicts', () => {
});
});
});
});
describe
(
'
when fast-forward merge enabled
'
,
()
=>
{
describe
(
'
when fast-forward
or semi-linear
merge enabled
'
,
()
=>
{
let
vm
;
let
vm
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
ConflictsComponent
,
{
vm
=
mountComponent
(
ConflictsComponent
,
{
mr
:
{
mr
:
{
ffOnlyEnabl
ed
:
true
,
shouldBeRebas
ed
:
true
,
},
},
});
});
});
});
...
...
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