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
11345866
Commit
11345866
authored
Feb 09, 2016
by
Rubén Dávila
Committed by
Robert Speicher
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't make Repository#revert aware of MRs.
parent
328b52d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
app/models/repository.rb
app/models/repository.rb
+3
-3
app/services/commits/revert_service.rb
app/services/commits/revert_service.rb
+6
-2
No files found.
app/models/repository.rb
View file @
11345866
...
...
@@ -622,14 +622,14 @@ class Repository
merge_commit_sha
end
def
revert
(
user
,
commit
,
base_branch
,
create_mr
=
false
)
def
revert
(
user
,
commit
,
base_branch
,
target_branch
=
nil
)
source_sha
=
find_branch
(
base_branch
).
target
target_branch
=
create_mr
?
commit
.
revert_branch_name
:
base_branch
target_branch
||=
base_branch
args
=
[
commit
.
id
,
source_sha
]
args
<<
{
mainline:
1
}
if
commit
.
merge_commit?
# Temporary branch exists and contains the revert commit
return
true
if
create_mr
&&
find_branch
(
target_branch
)
return
true
if
(
base_branch
!=
target_branch
)
&&
find_branch
(
target_branch
)
return
false
unless
diff_exists?
(
source_sha
,
commit
.
id
)
revert_index
=
rugged
.
revert_commit
(
*
args
)
...
...
app/services/commits/revert_service.rb
View file @
11345866
...
...
@@ -6,7 +6,7 @@ module Commits
@source_project
=
params
[
:source_project
]
||
@project
@target_branch
=
params
[
:target_branch
]
@commit
=
params
[
:commit
]
@create_merge_request
=
params
[
:create_merge_request
]
@create_merge_request
=
params
[
:create_merge_request
]
.
present?
# Check push permissions to branch
validate
...
...
@@ -23,7 +23,11 @@ module Commits
end
def
commit
repository
.
revert
(
current_user
,
@commit
,
@target_branch
,
@create_merge_request
)
if
@create_merge_request
repository
.
revert
(
current_user
,
@commit
,
@target_branch
,
@commit
.
revert_branch_name
)
else
repository
.
revert
(
current_user
,
@commit
,
@target_branch
)
end
end
private
...
...
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