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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
d958d027
Commit
d958d027
authored
Feb 15, 2016
by
Rubén Dávila
Committed by
Robert Speicher
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make #commit_with_hooks return the new obj id plus some other fixes.
parent
d34733ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
11 deletions
+20
-11
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+14
-4
app/models/repository.rb
app/models/repository.rb
+3
-4
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+1
-1
app/views/projects/merge_requests/widget/_merged.html.haml
app/views/projects/merge_requests/widget/_merged.html.haml
+2
-2
No files found.
app/helpers/commits_helper.rb
View file @
d958d027
...
...
@@ -123,14 +123,16 @@ module CommitsHelper
)
end
def
revert_commit_link
(
continue_to_path
,
btn_class:
nil
)
def
revert_commit_link
(
co
mmit
,
co
ntinue_to_path
,
btn_class:
nil
)
return
unless
current_user
tooltip
=
"Revert this
#{
revert_commit_type
(
commit
)
}
in a new merge request"
if
can_collaborate_with_project?
content_tag
:span
,
'data-toggle'
=>
'modal'
,
'data-target'
=>
'#modal-revert-commit'
do
link_to
'Revert'
,
'#modal-revert-commit'
,
'data-toggle'
=>
'tooltip'
,
'data-original-title'
=>
'Create merge request to revert commit'
,
class:
"btn btn-close btn-
#{
btn_class
}
"
link_to
'Revert'
,
'#modal-revert-commit'
,
'data-toggle'
=>
'tooltip'
,
'data-original-title'
=>
tooltip
,
class:
"btn btn-close btn-
#{
btn_class
}
"
end
els
e
els
if
can?
(
current_user
,
:fork_project
,
@project
)
continue_params
=
{
to:
continue_to_path
,
notice:
edit_in_new_fork_notice
+
' Try to revert this commit again.'
,
...
...
@@ -140,7 +142,15 @@ module CommitsHelper
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
link_to
'Revert'
,
fork_path
,
class:
'btn btn-grouped btn-close'
,
method: :post
,
'data-toggle'
=>
'tooltip'
,
'data-original-title'
=>
'Create merge request to revert commit'
link_to
'Revert'
,
fork_path
,
class:
'btn btn-grouped btn-close'
,
method: :post
,
'data-toggle'
=>
'tooltip'
,
'data-original-title'
=>
tooltip
end
end
def
revert_commit_type
(
commit
)
if
commit
.
merged_merge_request
'merge request'
else
'commit'
end
end
...
...
app/models/repository.rb
View file @
d958d027
...
...
@@ -601,7 +601,6 @@ class Repository
def
merge
(
user
,
source_sha
,
target_branch
,
options
=
{})
our_commit
=
rugged
.
branches
[
target_branch
].
target
their_commit
=
rugged
.
lookup
(
source_sha
)
merge_commit_sha
=
nil
raise
"Invalid merge target"
if
our_commit
.
nil?
raise
"Invalid merge source"
if
their_commit
.
nil?
...
...
@@ -616,10 +615,8 @@ class Repository
update_ref:
ref
)
merge_commit_sha
=
Rugged
::
Commit
.
create
(
rugged
,
actual_options
)
Rugged
::
Commit
.
create
(
rugged
,
actual_options
)
end
merge_commit_sha
end
def
revert
(
user
,
commit
,
base_branch
,
target_branch
=
nil
)
...
...
@@ -762,6 +759,8 @@ class Repository
end
end
end
newrev
end
end
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
d958d027
...
...
@@ -17,7 +17,7 @@
=
icon
(
'files-o'
)
Browse Files
-
unless
@commit
.
has_been_reverted?
(
current_user
)
=
revert_commit_link
(
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
))
=
revert_commit_link
(
@commit
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
))
%div
%p
...
...
app/views/projects/merge_requests/widget/_merged.html.haml
View file @
d958d027
...
...
@@ -6,8 +6,8 @@
-
if
@merge_request
.
merge_event
by
#{
link_to_member
(
@project
,
@merge_request
.
merge_event
.
author
,
avatar:
true
)
}
#{
time_ago_with_tooltip
(
@merge_request
.
merge_event
.
created_at
)
}
-
unless
@merge_request
.
has_been_reverted?
(
current_user
)
=
revert_commit_link
(
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
btn_class:
'sm'
)
-
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'
)
%div
-
if
!
@merge_request
.
source_branch_exists?
||
(
params
[
:delete_source
]
==
'true'
)
The changes were merged into
...
...
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