Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
d99758a9
Commit
d99758a9
authored
Dec 04, 2016
by
Sander van Harmelen
Committed by
GitHub
Dec 04, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixup PR #82 (#104)
* Support for AcceptMergeRequest parameters * Fixup PR #82
parent
5cf34379
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
merge_requests.go
merge_requests.go
+15
-2
No files found.
merge_requests.go
View file @
d99758a9
...
@@ -277,6 +277,18 @@ func (s *MergeRequestsService) UpdateMergeRequest(
...
@@ -277,6 +277,18 @@ func (s *MergeRequestsService) UpdateMergeRequest(
return
m
,
resp
,
err
return
m
,
resp
,
err
}
}
// AcceptMergeRequestOptions represents the available AcceptMergeRequest()
// options.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/merge_requests.html#accept-mr
type
AcceptMergeRequestOptions
struct
{
MergeCommitMessage
*
string
`url:"merge_commit_message,omitempty" json:"merge_commit_message,omitempty"`
ShouldRemoveSourceBranch
*
bool
`url:"should_remove_source_branch,omitempty" json:"should_remove_source_branch,omitempty"`
MergeWhenBuildSucceeds
*
bool
`url:"merge_when_build_succeeds,omitempty" json:"merge_when_build_succeeds,omitempty"`
Sha
*
string
`url:"sha,omitempty" json:"sha,omitempty"`
}
// AcceptMergeRequest merges changes submitted with MR using this API. If merge
// AcceptMergeRequest merges changes submitted with MR using this API. If merge
// success you get 200 OK. If it has some conflicts and can not be merged - you
// success you get 200 OK. If it has some conflicts and can not be merged - you
// get 405 and error message 'Branch cannot be merged'. If merge request is
// get 405 and error message 'Branch cannot be merged'. If merge request is
...
@@ -286,14 +298,15 @@ func (s *MergeRequestsService) UpdateMergeRequest(
...
@@ -286,14 +298,15 @@ func (s *MergeRequestsService) UpdateMergeRequest(
// http://doc.gitlab.com/ce/api/merge_requests.html#accept-mr
// http://doc.gitlab.com/ce/api/merge_requests.html#accept-mr
func
(
s
*
MergeRequestsService
)
AcceptMergeRequest
(
func
(
s
*
MergeRequestsService
)
AcceptMergeRequest
(
pid
interface
{},
pid
interface
{},
mergeRequest
int
)
(
*
MergeRequest
,
*
Response
,
error
)
{
mergeRequest
int
,
opt
*
AcceptMergeRequestOptions
)
(
*
MergeRequest
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_request/%d/merge"
,
url
.
QueryEscape
(
project
),
mergeRequest
)
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_request/%d/merge"
,
url
.
QueryEscape
(
project
),
mergeRequest
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
...
...
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