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
5ef3f80d
Commit
5ef3f80d
authored
Feb 18, 2016
by
Rubén Dávila
Committed by
Robert Speicher
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More updates from the last code review.
parent
78d3444f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
19 deletions
+20
-19
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+2
-1
app/models/commit.rb
app/models/commit.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+2
-4
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+1
-1
app/views/projects/merge_requests/show/_mr_title.html.haml
app/views/projects/merge_requests/show/_mr_title.html.haml
+1
-1
app/views/projects/merge_requests/widget/_merged.html.haml
app/views/projects/merge_requests/widget/_merged.html.haml
+2
-11
app/views/projects/merge_requests/widget/_merged_buttons.haml
...views/projects/merge_requests/widget/_merged_buttons.haml
+11
-0
No files found.
app/controllers/projects/commit_controller.rb
View file @
5ef3f80d
...
@@ -11,7 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -11,7 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
before_action
:authorize_read_commit_status!
,
only:
[
:builds
]
before_action
:authorize_read_commit_status!
,
only:
[
:builds
]
before_action
:commit
before_action
:commit
before_action
:define_show_vars
,
only:
[
:show
,
:builds
]
before_action
:define_show_vars
,
only:
[
:show
,
:builds
]
before_action
:assign_revert_commit_vars
,
only:
[
:revert
]
before_action
:authorize_edit_tree!
,
only:
[
:revert
]
before_action
:authorize_edit_tree!
,
only:
[
:revert
]
def
show
def
show
...
@@ -60,6 +59,8 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -60,6 +59,8 @@ class Projects::CommitController < Projects::ApplicationController
end
end
def
revert
def
revert
assign_revert_commit_vars
return
render_404
if
@target_branch
.
blank?
return
render_404
if
@target_branch
.
blank?
create_commit
(
Commits
::
RevertService
,
success_notice:
"The
#{
revert_type_title
}
has been successfully reverted."
,
create_commit
(
Commits
::
RevertService
,
success_notice:
"The
#{
revert_type_title
}
has been successfully reverted."
,
...
...
app/models/commit.rb
View file @
5ef3f80d
...
@@ -242,7 +242,7 @@ class Commit
...
@@ -242,7 +242,7 @@ class Commit
def
merged_merge_request
def
merged_merge_request
return
@merged_merge_request
if
defined?
(
@merged_merge_request
)
return
@merged_merge_request
if
defined?
(
@merged_merge_request
)
@merged_merge_request
=
merge_commit?
&&
project
.
merge_requests
.
find_by
(
merge_commit_sha:
id
)
@merged_merge_request
=
project
.
merge_requests
.
find_by
(
merge_commit_sha:
id
)
if
merge_commit?
end
end
def
has_been_reverted?
(
current_user
=
nil
,
noteable
=
self
)
def
has_been_reverted?
(
current_user
=
nil
,
noteable
=
self
)
...
...
app/models/merge_request.rb
View file @
5ef3f80d
...
@@ -538,9 +538,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -538,9 +538,7 @@ class MergeRequest < ActiveRecord::Base
@merge_commit
||=
project
.
commit
(
merge_commit_sha
)
if
merge_commit_sha
@merge_commit
||=
project
.
commit
(
merge_commit_sha
)
if
merge_commit_sha
end
end
def
has_been_reverted?
(
current_user
=
nil
)
def
can_be_reverted?
(
current_user
=
nil
)
if
merge_commit
merge_commit
&&
!
merge_commit
.
has_been_reverted?
(
current_user
,
self
)
merge_commit
.
has_been_reverted?
(
current_user
,
self
)
end
end
end
end
end
app/views/projects/merge_requests/_show.html.haml
View file @
5ef3f80d
...
@@ -85,7 +85,7 @@
...
@@ -85,7 +85,7 @@
=
spinner
=
spinner
=
render
'shared/issuable/sidebar'
,
issuable:
@merge_request
=
render
'shared/issuable/sidebar'
,
issuable:
@merge_request
-
if
@merge_request
.
merge_commit
&&
!
@merge_request
.
has_been_reverted?
(
current_user
)
-
if
@merge_request
.
can_be_reverted?
=
render
"projects/commit/revert"
,
commit:
@merge_request
.
merge_commit
,
title:
@merge_request
.
title
=
render
"projects/commit/revert"
,
commit:
@merge_request
.
merge_commit
,
title:
@merge_request
.
title
:javascript
:javascript
...
...
app/views/projects/merge_requests/show/_mr_title.html.haml
View file @
5ef3f80d
...
@@ -17,4 +17,4 @@
...
@@ -17,4 +17,4 @@
%i
.fa.fa-pencil-square-o
%i
.fa.fa-pencil-square-o
Edit
Edit
-
if
@merge_request
.
closed?
-
if
@merge_request
.
closed?
=
link_to
'Reopen'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
'btn btn-nr btn-grouped btn-reopen reopen-mr-link'
,
title:
"Reopen merge request"
=
link_to
'Reopen'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
'btn btn-nr btn-grouped btn-reopen reopen-mr-link'
,
title:
'Reopen merge request'
app/views/projects/merge_requests/widget/_merged.html.haml
View file @
5ef3f80d
...
@@ -7,28 +7,19 @@
...
@@ -7,28 +7,19 @@
by
#{
link_to_member
(
@project
,
@merge_request
.
merge_event
.
author
,
avatar:
true
)
}
by
#{
link_to_member
(
@project
,
@merge_request
.
merge_event
.
author
,
avatar:
true
)
}
#{
time_ago_with_tooltip
(
@merge_request
.
merge_event
.
created_at
)
}
#{
time_ago_with_tooltip
(
@merge_request
.
merge_event
.
created_at
)
}
%div
%div
-
revert_button
=
capture_haml
do
-
if
@merge_request
.
merge_commit
&&
!
@merge_request
.
has_been_reverted?
(
current_user
)
=
revert_commit_link
(
@merge_request
.
merge_commit
,
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
btn_class:
'sm'
)
-
if
!
@merge_request
.
source_branch_exists?
||
(
params
[
:delete_source
]
==
'true'
)
-
if
!
@merge_request
.
source_branch_exists?
||
(
params
[
:delete_source
]
==
'true'
)
%p
%p
The changes were merged into
The changes were merged into
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
The source branch has been removed.
The source branch has been removed.
-
if
revert_button
.
present?
=
render
'projects/merge_requests/widget/merged_buttons'
.btn-group
=
revert_button
-
elsif
@merge_request
.
can_remove_source_branch?
(
current_user
)
-
elsif
@merge_request
.
can_remove_source_branch?
(
current_user
)
.remove_source_branch_widget
.remove_source_branch_widget
%p
%p
The changes were merged into
The changes were merged into
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
You can remove the source branch now.
You can remove the source branch now.
.btn-group
=
render
'projects/merge_requests/widget/merged_buttons'
,
source_branch_exists:
true
=
link_to
namespace_project_branch_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
@merge_request
.
source_branch
),
remote:
true
,
method: :delete
,
class:
"btn btn-default btn-grouped btn-sm remove_source_branch"
do
%i
.fa.fa-trash-o
Remove Source Branch
=
revert_button
.remove_source_branch_widget.failed.hide
.remove_source_branch_widget.failed.hide
%p
%p
Failed to remove source branch '
#{
@merge_request
.
source_branch
}
'.
Failed to remove source branch '
#{
@merge_request
.
source_branch
}
'.
...
...
app/views/projects/merge_requests/widget/_merged_buttons.haml
0 → 100644
View file @
5ef3f80d
-
source_branch_exists
=
local_assigns
.
fetch
(
:source_branch_exists
,
false
)
-
mr_can_be_reverted
=
@merge_request
.
can_be_reverted?
-
if
source_branch_exists
||
mr_can_be_reverted
.btn-group
-
if
source_branch_exists
=
link_to
namespace_project_branch_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
@merge_request
.
source_branch
),
remote:
true
,
method: :delete
,
class:
"btn btn-default btn-grouped btn-sm remove_source_branch"
do
=
icon
(
'trash-o'
)
Remove Source Branch
-
if
mr_can_be_reverted
=
revert_commit_link
(
@merge_request
.
merge_commit
,
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
btn_class:
'sm'
)
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