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
...
@@ -123,14 +123,16 @@ module CommitsHelper
)
)
end
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
return
unless
current_user
tooltip
=
"Revert this
#{
revert_commit_type
(
commit
)
}
in a new merge request"
if
can_collaborate_with_project?
if
can_collaborate_with_project?
content_tag
:span
,
'data-toggle'
=>
'modal'
,
'data-target'
=>
'#modal-revert-commit'
do
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
end
els
e
els
if
can?
(
current_user
,
:fork_project
,
@project
)
continue_params
=
{
continue_params
=
{
to:
continue_to_path
,
to:
continue_to_path
,
notice:
edit_in_new_fork_notice
+
' Try to revert this commit again.'
,
notice:
edit_in_new_fork_notice
+
' Try to revert this commit again.'
,
...
@@ -140,7 +142,15 @@ module CommitsHelper
...
@@ -140,7 +142,15 @@ module CommitsHelper
namespace_key:
current_user
.
namespace
.
id
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
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
end
end
...
...
app/models/repository.rb
View file @
d958d027
...
@@ -601,7 +601,6 @@ class Repository
...
@@ -601,7 +601,6 @@ class Repository
def
merge
(
user
,
source_sha
,
target_branch
,
options
=
{})
def
merge
(
user
,
source_sha
,
target_branch
,
options
=
{})
our_commit
=
rugged
.
branches
[
target_branch
].
target
our_commit
=
rugged
.
branches
[
target_branch
].
target
their_commit
=
rugged
.
lookup
(
source_sha
)
their_commit
=
rugged
.
lookup
(
source_sha
)
merge_commit_sha
=
nil
raise
"Invalid merge target"
if
our_commit
.
nil?
raise
"Invalid merge target"
if
our_commit
.
nil?
raise
"Invalid merge source"
if
their_commit
.
nil?
raise
"Invalid merge source"
if
their_commit
.
nil?
...
@@ -616,10 +615,8 @@ class Repository
...
@@ -616,10 +615,8 @@ class Repository
update_ref:
ref
update_ref:
ref
)
)
merge_commit_sha
=
Rugged
::
Commit
.
create
(
rugged
,
actual_options
)
Rugged
::
Commit
.
create
(
rugged
,
actual_options
)
end
end
merge_commit_sha
end
end
def
revert
(
user
,
commit
,
base_branch
,
target_branch
=
nil
)
def
revert
(
user
,
commit
,
base_branch
,
target_branch
=
nil
)
...
@@ -762,6 +759,8 @@ class Repository
...
@@ -762,6 +759,8 @@ class Repository
end
end
end
end
end
end
newrev
end
end
end
end
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
d958d027
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
=
icon
(
'files-o'
)
=
icon
(
'files-o'
)
Browse Files
Browse Files
-
unless
@commit
.
has_been_reverted?
(
current_user
)
-
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
%div
%p
%p
...
...
app/views/projects/merge_requests/widget/_merged.html.haml
View file @
d958d027
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
-
if
@merge_request
.
merge_event
-
if
@merge_request
.
merge_event
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
)
}
-
unless
@merge_request
.
has_been_reverted?
(
current_user
)
-
if
@merge_request
.
merge_commit
&&
!
@merge_request
.
has_been_reverted?
(
current_user
)
=
revert_commit_link
(
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
btn_class:
'sm'
)
=
revert_commit_link
(
@merge_request
.
merge_commit
,
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
btn_class:
'sm'
)
%div
%div
-
if
!
@merge_request
.
source_branch_exists?
||
(
params
[
:delete_source
]
==
'true'
)
-
if
!
@merge_request
.
source_branch_exists?
||
(
params
[
:delete_source
]
==
'true'
)
The changes were merged into
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