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
c2683335
Unverified
Commit
c2683335
authored
Dec 24, 2018
by
Sander van Harmelen
Committed by
GitHub
Dec 24, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #534 from xanzy/f-mr-rebase
Add support to rebase a merge request
parents
90594298
a6bab794
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
2 deletions
+41
-2
merge_requests.go
merge_requests.go
+41
-2
No files found.
merge_requests.go
View file @
c2683335
...
...
@@ -111,6 +111,13 @@ type MergeRequest struct {
SHA
string
`json:"sha"`
Status
string
`json:"status"`
}
`json:"pipeline"`
DiffRefs
struct
{
BaseSha
string
`json:"base_sha"`
HeadSha
string
`json:"head_sha"`
StartSha
string
`json:"start_sha"`
}
`json:"diff_refs"`
DivergedCommitsCount
int
`json:"diverged_commits_count"`
RebaseInProgress
bool
`json:"rebase_in_progress"`
}
func
(
m
MergeRequest
)
String
()
string
{
...
...
@@ -289,18 +296,29 @@ func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *Li
return
m
,
resp
,
err
}
// GetMergeRequestsOptions represents the available GetMergeRequests()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr
type
GetMergeRequestsOptions
struct
{
RenderHTML
*
bool
`url:"render_html,omitempty" json:"render_html,omitempty"`
IncludeDivergedCommitsCount
*
bool
`url:"include_diverged_commits_count,omitempty" json:"include_diverged_commits_count,omitempty"`
IncludeRebaseInProgress
*
bool
`url:"include_rebase_in_progress,omitempty" json:"include_rebase_in_progress,omitempty"`
}
// GetMergeRequest shows information about a single merge request.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr
func
(
s
*
MergeRequestsService
)
GetMergeRequest
(
pid
interface
{},
mergeRequest
int
,
options
...
OptionFunc
)
(
*
MergeRequest
,
*
Response
,
error
)
{
func
(
s
*
MergeRequestsService
)
GetMergeRequest
(
pid
interface
{},
mergeRequest
int
,
opt
*
GetMergeRequestsOptions
,
opt
ions
...
OptionFunc
)
(
*
MergeRequest
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_requests/%d"
,
url
.
QueryEscape
(
project
),
mergeRequest
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
@@ -631,6 +649,27 @@ func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{},
return
m
,
resp
,
err
}
// RebaseMergeRequest automatically rebases the source_branch of the merge
// request against its target_branch. If you don’t have permissions to push
// to the merge request’s source branch, you’ll get a 403 Forbidden response.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#rebase-a-merge-request
func
(
s
*
MergeRequestsService
)
RebaseMergeRequest
(
pid
interface
{},
mergeRequest
int
,
options
...
OptionFunc
)
(
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_requests/%d/rebase"
,
url
.
QueryEscape
(
project
),
mergeRequest
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
err
}
return
s
.
client
.
Do
(
req
,
nil
)
}
// GetMergeRequestDiffVersionsOptions represents the available
// GetMergeRequestDiffVersions() options.
//
...
...
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