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
26ea551e
Commit
26ea551e
authored
May 30, 2018
by
JB Sazon
Committed by
Sander van Harmelen
May 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add merge method constants (#410)
parent
72694947
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
25 deletions
+50
-25
gitlab.go
gitlab.go
+22
-0
projects.go
projects.go
+24
-24
projects_test.go
projects_test.go
+4
-1
No files found.
gitlab.go
View file @
26ea551e
...
...
@@ -213,6 +213,20 @@ const (
PublicVisibility
VisibilityValue
=
"public"
)
// MergeMethodValue represents a project merge type within GitLab.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
type
MergeMethodValue
string
// List of available merge type
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
const
(
NoFastForwardMerge
MergeMethodValue
=
"merge"
FastForwardMerge
MergeMethodValue
=
"ff"
RebaseMerge
MergeMethodValue
=
"rebase_merge"
)
// EventTypeValue represents actions type for contribution events
type
EventTypeValue
string
...
...
@@ -830,3 +844,11 @@ func Visibility(v VisibilityValue) *VisibilityValue {
*
p
=
v
return
p
}
// MergeMethod is a helper routine that allocates a new MergeMethod
// to sotre v and returns a pointer to it.
func
MergeMethod
(
v
MergeMethodValue
)
*
MergeMethodValue
{
p
:=
new
(
MergeMethodValue
)
*
p
=
v
return
p
}
projects.go
View file @
26ea551e
...
...
@@ -373,30 +373,30 @@ func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEvent
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#create-project
type
CreateProjectOptions
struct
{
Name
*
string
`url:"name,omitempty" json:"name,omitempty"`
Path
*
string
`url:"path,omitempty" json:"path,omitempty"`
DefaultBranch
*
string
`url:"default_branch,omitempty" json:"default_branch,omitempty"`
NamespaceID
*
int
`url:"namespace_id,omitempty" json:"namespace_id,omitempty"`
Description
*
string
`url:"description,omitempty" json:"description,omitempty"`
IssuesEnabled
*
bool
`url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
MergeRequestsEnabled
*
bool
`url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"`
JobsEnabled
*
bool
`url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"`
WikiEnabled
*
bool
`url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"`
SnippetsEnabled
*
bool
`url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
ResolveOutdatedDiffDiscussions
*
bool
`url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
ContainerRegistryEnabled
*
bool
`url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
SharedRunnersEnabled
*
bool
`url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
Visibility
*
VisibilityValue
`url:"visibility,omitempty" json:"visibility,omitempty"`
ImportURL
*
string
`url:"import_url,omitempty" json:"import_url,omitempty"`
PublicJobs
*
bool
`url:"public_jobs,omitempty" json:"public_jobs,omitempty"`
OnlyAllowMergeIfPipelineSucceeds
*
bool
`url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
OnlyAllowMergeIfAllDiscussionsAreResolved
*
bool
`url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
MergeMethod
*
string
`url:"merge_method,omitempty" json:"merge_method,omitempty"`
LFSEnabled
*
bool
`url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled
*
bool
`url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
TagList
*
[]
string
`url:"tag_list,omitempty" json:"tag_list,omitempty"`
PrintingMergeRequestLinkEnabled
*
bool
`url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"`
CIConfigPath
*
string
`url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
Name
*
string
`url:"name,omitempty" json:"name,omitempty"`
Path
*
string
`url:"path,omitempty" json:"path,omitempty"`
DefaultBranch
*
string
`url:"default_branch,omitempty" json:"default_branch,omitempty"`
NamespaceID
*
int
`url:"namespace_id,omitempty" json:"namespace_id,omitempty"`
Description
*
string
`url:"description,omitempty" json:"description,omitempty"`
IssuesEnabled
*
bool
`url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
MergeRequestsEnabled
*
bool
`url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"`
JobsEnabled
*
bool
`url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"`
WikiEnabled
*
bool
`url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"`
SnippetsEnabled
*
bool
`url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
ResolveOutdatedDiffDiscussions
*
bool
`url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
ContainerRegistryEnabled
*
bool
`url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
SharedRunnersEnabled
*
bool
`url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
Visibility
*
VisibilityValue
`url:"visibility,omitempty" json:"visibility,omitempty"`
ImportURL
*
string
`url:"import_url,omitempty" json:"import_url,omitempty"`
PublicJobs
*
bool
`url:"public_jobs,omitempty" json:"public_jobs,omitempty"`
OnlyAllowMergeIfPipelineSucceeds
*
bool
`url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
OnlyAllowMergeIfAllDiscussionsAreResolved
*
bool
`url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
MergeMethod
*
MergeMethodValue
`url:"merge_method,omitempty" json:"merge_method,omitempty"`
LFSEnabled
*
bool
`url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled
*
bool
`url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
TagList
*
[]
string
`url:"tag_list,omitempty" json:"tag_list,omitempty"`
PrintingMergeRequestLinkEnabled
*
bool
`url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"`
CIConfigPath
*
string
`url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
}
// CreateProject creates a new project owned by the authenticated user.
...
...
projects_test.go
View file @
26ea551e
...
...
@@ -234,7 +234,10 @@ func TestCreateProject(t *testing.T) {
fmt
.
Fprint
(
w
,
`{"id":1}`
)
})
opt
:=
&
CreateProjectOptions
{
Name
:
String
(
"n"
)}
opt
:=
&
CreateProjectOptions
{
Name
:
String
(
"n"
),
MergeMethod
:
MergeMethod
(
RebaseMerge
),
}
project
,
_
,
err
:=
client
.
Projects
.
CreateProject
(
opt
)
if
err
!=
nil
{
...
...
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