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
8ccd460d
Commit
8ccd460d
authored
Jul 17, 2020
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dry_run param to cherry-pick and revert APIs
parent
68c0a4cd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
lib/api/commits.rb
lib/api/commits.rb
+18
-6
No files found.
lib/api/commits.rb
View file @
8ccd460d
...
@@ -203,6 +203,7 @@ module API
...
@@ -203,6 +203,7 @@ module API
params
do
params
do
requires
:sha
,
type:
String
,
desc:
'A commit sha, or the name of a branch or tag to be cherry picked'
requires
:sha
,
type:
String
,
desc:
'A commit sha, or the name of a branch or tag to be cherry picked'
requires
:branch
,
type:
String
,
desc:
'The name of the branch'
,
allow_blank:
false
requires
:branch
,
type:
String
,
desc:
'The name of the branch'
,
allow_blank:
false
optional
:dry_run
,
type:
Boolean
,
default:
false
,
desc:
"Don't commit any changes"
end
end
post
':id/repository/commits/:sha/cherry_pick'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
post
':id/repository/commits/:sha/cherry_pick'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
authorize_push_to_branch!
(
params
[
:branch
])
authorize_push_to_branch!
(
params
[
:branch
])
...
@@ -215,7 +216,8 @@ module API
...
@@ -215,7 +216,8 @@ module API
commit_params
=
{
commit_params
=
{
commit:
commit
,
commit:
commit
,
start_branch:
params
[
:branch
],
start_branch:
params
[
:branch
],
branch_name:
params
[
:branch
]
branch_name:
params
[
:branch
],
dry_run:
params
[
:dry_run
]
}
}
result
=
::
Commits
::
CherryPickService
result
=
::
Commits
::
CherryPickService
...
@@ -223,8 +225,12 @@ module API
...
@@ -223,8 +225,12 @@ module API
.
execute
.
execute
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
if
params
[
:dry_run
]
no_content!
else
present
user_project
.
repository
.
commit
(
result
[
:result
]),
present
user_project
.
repository
.
commit
(
result
[
:result
]),
with:
Entities
::
Commit
with:
Entities
::
Commit
end
else
else
error!
(
result
.
slice
(
:message
,
:error_code
),
400
,
header
)
error!
(
result
.
slice
(
:message
,
:error_code
),
400
,
header
)
end
end
...
@@ -237,6 +243,7 @@ module API
...
@@ -237,6 +243,7 @@ module API
params
do
params
do
requires
:sha
,
type:
String
,
desc:
'Commit SHA to revert'
requires
:sha
,
type:
String
,
desc:
'Commit SHA to revert'
requires
:branch
,
type:
String
,
desc:
'Target branch name'
,
allow_blank:
false
requires
:branch
,
type:
String
,
desc:
'Target branch name'
,
allow_blank:
false
optional
:dry_run
,
type:
Boolean
,
default:
false
,
desc:
"Don't commit any changes"
end
end
post
':id/repository/commits/:sha/revert'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
post
':id/repository/commits/:sha/revert'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
authorize_push_to_branch!
(
params
[
:branch
])
authorize_push_to_branch!
(
params
[
:branch
])
...
@@ -249,7 +256,8 @@ module API
...
@@ -249,7 +256,8 @@ module API
commit_params
=
{
commit_params
=
{
commit:
commit
,
commit:
commit
,
start_branch:
params
[
:branch
],
start_branch:
params
[
:branch
],
branch_name:
params
[
:branch
]
branch_name:
params
[
:branch
],
dry_run:
params
[
:dry_run
]
}
}
result
=
::
Commits
::
RevertService
result
=
::
Commits
::
RevertService
...
@@ -257,8 +265,12 @@ module API
...
@@ -257,8 +265,12 @@ module API
.
execute
.
execute
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
if
params
[
:dry_run
]
no_content!
else
present
user_project
.
repository
.
commit
(
result
[
:result
]),
present
user_project
.
repository
.
commit
(
result
[
:result
]),
with:
Entities
::
Commit
with:
Entities
::
Commit
end
else
else
error!
(
result
.
slice
(
:message
,
:error_code
),
400
,
header
)
error!
(
result
.
slice
(
:message
,
:error_code
),
400
,
header
)
end
end
...
...
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