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
7d21d203
Commit
7d21d203
authored
Sep 29, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move semi-linear merge strategy to CE area (mostly FE)
parent
33985a9c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
64 additions
and
36 deletions
+64
-36
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/models/project.rb
app/models/project.rb
+28
-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
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+0
-1
ee/app/models/ee/merge_request.rb
ee/app/models/ee/merge_request.rb
+0
-10
ee/app/views/projects/ee/_merge_request_settings.html.haml
ee/app/views/projects/ee/_merge_request_settings.html.haml
+1
-2
spec/ee/spec/features/projects/project_settings_spec.rb
spec/ee/spec/features/projects/project_settings_spec.rb
+0
-20
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 @
7d21d203
...
...
@@ -15,7 +15,7 @@ export default {
showDisabledButton />
<div class="media-body space-children">
<span
v-if="mr.
ffOnlyEnabl
ed"
v-if="mr.
shouldBeRebas
ed"
class="bold">
Fast-forward merge is not possible.
To merge this request, first rebase locally.
...
...
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
7d21d203
...
...
@@ -60,6 +60,7 @@ export default class MergeRequestStore {
this
.
mergeWhenPipelineSucceeds
=
data
.
merge_when_pipeline_succeeds
||
false
;
this
.
mergePath
=
data
.
merge_path
;
this
.
ffOnlyEnabled
=
data
.
ff_only_enabled
;
this
.
shouldBeRebased
=
!!
data
.
should_be_rebased
;
this
.
statusPath
=
data
.
status_path
;
this
.
emailPatchesPath
=
data
.
email_patches_path
;
this
.
plainDiffPath
=
data
.
plain_diff_path
;
...
...
app/models/merge_request.rb
View file @
7d21d203
...
...
@@ -549,6 +549,14 @@ class MergeRequest < ActiveRecord::Base
true
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
)
can_be_merged_by?
(
current_user
)
||
self
.
author
==
current_user
end
...
...
app/models/project.rb
View file @
7d21d203
...
...
@@ -1557,6 +1557,34 @@ class Project < ActiveRecord::Base
persisted?
&&
path_changed?
end
def
merge_method
if
self
.
merge_requests_ff_only_enabled
:ff
elsif
self
.
merge_requests_rebase_enabled
:rebase_merge
else
:merge
end
end
def
merge_method
=
(
method
)
case
method
.
to_s
when
"ff"
self
.
merge_requests_ff_only_enabled
=
true
self
.
merge_requests_rebase_enabled
=
true
when
"rebase_merge"
self
.
merge_requests_ff_only_enabled
=
false
self
.
merge_requests_rebase_enabled
=
true
when
"merge"
self
.
merge_requests_ff_only_enabled
=
false
self
.
merge_requests_rebase_enabled
=
false
end
end
def
ff_merge_must_be_possible?
self
.
merge_requests_ff_only_enabled
||
self
.
merge_requests_rebase_enabled
end
private
def
storage
...
...
app/views/projects/_merge_request_rebase_settings.html.haml
0 → 100644
View file @
7d21d203
-
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 @
7d21d203
...
...
@@ -11,6 +11,8 @@
%span
.descr
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
'projects/merge_request_merge_settings'
,
form:
form
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
7d21d203
...
...
@@ -23,7 +23,6 @@ export default class MergeRequestStore extends CEMergeRequestStore {
}
initRebase
(
data
)
{
this
.
shouldBeRebased
=
!!
data
.
should_be_rebased
;
this
.
canPushToSourceBranch
=
data
.
can_push_to_source_branch
;
this
.
rebaseInProgress
=
data
.
rebase_in_progress
;
this
.
approvalsLeft
=
!
data
.
approved
;
...
...
ee/app/models/ee/merge_request.rb
View file @
7d21d203
...
...
@@ -13,16 +13,6 @@ module EE
delegate
:codeclimate_artifact
,
to: :base_pipeline
,
prefix: :base
,
allow_nil:
true
end
def
ff_merge_possible?
project
.
repository
.
ancestor?
(
target_branch_sha
,
diff_head_sha
)
end
def
should_be_rebased?
project
.
feature_available?
(
:merge_request_rebase
)
&&
project
.
ff_merge_must_be_possible?
&&
!
ff_merge_possible?
end
def
rebase_dir_path
File
.
join
(
::
Gitlab
.
config
.
shared
.
path
,
'tmp/rebase'
,
source_project
.
id
.
to_s
,
id
.
to_s
).
to_s
end
...
...
ee/app/views/projects/ee/_merge_request_settings.html.haml
View file @
7d21d203
...
...
@@ -11,8 +11,7 @@
%span
.descr
A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.
-
if
@project
.
feature_available?
(
:merge_request_rebase
)
=
render
'projects/ee/merge_request_rebase_settings'
,
project:
@project
,
form:
form
=
render
'projects/ee/merge_request_rebase_settings'
,
form:
form
=
render
'projects/ee/merge_request_fast_forward_settings'
,
project:
@project
,
form:
form
...
...
spec/ee/spec/features/projects/project_settings_spec.rb
deleted
100644 → 0
View file @
33985a9c
require
'spec_helper'
describe
'Edit Project Settings'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
,
path:
'gitlab'
,
name:
'sample'
)
}
before
do
sign_in
(
user
)
end
describe
'Merge request settings section'
do
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
end
end
spec/features/projects/project_settings_spec.rb
View file @
7d21d203
...
...
@@ -41,6 +41,14 @@ describe 'Edit Project Settings' do
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
visit
edit_project_path
(
project
)
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
View file @
7d21d203
...
...
@@ -81,13 +81,13 @@ describe('MRWidgetConflicts', () => {
});
});
describe
(
'
when fast-forward merge enabled
'
,
()
=>
{
describe
(
'
when fast-forward
or semi-linear
merge enabled
'
,
()
=>
{
let
vm
;
beforeEach
(()
=>
{
vm
=
mountComponent
(
ConflictsComponent
,
{
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