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
584ff6f8
Commit
584ff6f8
authored
Aug 27, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render rebase button and ff merge button
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
e5f75999
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
5 deletions
+44
-5
app/models/merge_request.rb
app/models/merge_request.rb
+8
-0
app/views/projects/merge_requests/widget/_open.html.haml
app/views/projects/merge_requests/widget/_open.html.haml
+2
-0
app/views/projects/merge_requests/widget/open/_accept.html.haml
...ews/projects/merge_requests/widget/open/_accept.html.haml
+0
-5
app/views/projects/merge_requests/widget/open/_ff_accept.html.haml
.../projects/merge_requests/widget/open/_ff_accept.html.haml
+32
-0
config/routes.rb
config/routes.rb
+2
-0
No files found.
app/models/merge_request.rb
View file @
584ff6f8
...
...
@@ -498,4 +498,12 @@ class MergeRequest < ActiveRecord::Base
unlock_mr
if
locked?
end
end
def
source_sha_parent
source_project
.
repository
.
commit
(
source_sha
).
parents
.
first
.
sha
end
def
ff_merge_possible?
target_sha
==
source_sha_parent
end
end
app/views/projects/merge_requests/widget/_open.html.haml
View file @
584ff6f8
...
...
@@ -17,6 +17,8 @@
=
render
'projects/merge_requests/widget/open/not_allowed'
-
elsif
@merge_request
.
requires_approve?
&&
!
@merge_request
.
approved?
=
render
'projects/merge_requests/widget/open/approve'
-
elsif
@project
.
merge_requests_ff_only_enabled
=
render
'projects/merge_requests/widget/open/ff_accept'
-
elsif
@merge_request
.
can_be_merged?
=
render
'projects/merge_requests/widget/open/accept'
...
...
app/views/projects/merge_requests/widget/open/_accept.html.haml
View file @
584ff6f8
...
...
@@ -9,11 +9,6 @@
=
label_tag
:should_remove_source_branch
,
class:
"remove_source_checkbox"
do
=
check_box_tag
:should_remove_source_branch
Remove source branch
-
if
@merge_request
.
target_project
.
merge_requests_rebase_enabled
&&
can_rebase?
(
@merge_request
.
target_project
,
@merge_request
.
target_branch
)
.accept-control.remove_branch_holder.checkbox
=
label_tag
:should_rebase
do
=
check_box_tag
:should_rebase
,
"1"
,
@project
.
merge_requests_rebase_default
Rebase before merge
.accept-control
=
link_to
"#"
,
class:
"modify-merge-commit-link js-toggle-button"
do
...
...
app/views/projects/merge_requests/widget/open/_ff_accept.html.haml
0 → 100644
View file @
584ff6f8
-
if
@merge_request
.
ff_merge_possible?
=
form_for
[
:ff_merge
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
remote:
true
,
method: :post
,
html:
{
class:
'accept-mr-form js-requires-input'
}
do
|
f
|
=
hidden_field_tag
:authenticity_token
,
form_authenticity_token
.accept-merge-holder.clearfix.js-toggle-container
.accept-action
=
f
.
button
class:
"btn btn-create accept-mr"
do
Accept Merge Request
.accept-control
Fast-forward merge without creating merge commit
-
else
=
form_for
[
:rebase
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
remote:
true
,
method: :post
,
html:
{
class:
'accept-mr-form js-requires-input'
}
do
|
f
|
=
hidden_field_tag
:authenticity_token
,
form_authenticity_token
.accept-merge-holder.clearfix.js-toggle-container
-
if
@merge_request
.
target_project
.
merge_requests_rebase_enabled
&&
can_rebase?
(
@merge_request
.
target_project
,
@merge_request
.
target_branch
)
.accept-action
=
f
.
button
class:
"btn btn-reopen rebase-mr"
do
Rebase from
#{
@merge_request
.
target_branch
}
.accept-control
Fast-forward merge is not possible. Branch must be rebased first
:coffeescript
$('.accept-mr-form').on 'ajax:before', ->
btn = $('.accept-mr')
btn.disable()
btn.html("<i class='fa fa-spinner fa-spin'></i> Merge in progress")
$('.rebase-mr-form').on 'ajax:before', ->
btn = $('.rebase-mr')
btn.disable()
btn.html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress. It could take some time")
config/routes.rb
View file @
584ff6f8
...
...
@@ -505,6 +505,8 @@ Gitlab::Application.routes.draw do
get
:ci_status
post
:toggle_subscription
post
:approve
post
:rebase
post
:ff_merge
end
collection
do
...
...
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