Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #34 from gotsunami/issue-29
Browse files Browse the repository at this point in the history
Use GitLab API v4
  • Loading branch information
aboutofpluto authored Jun 3, 2018
2 parents 70c9d5f + 5d0d200 commit 20f1e5e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
v 0.7
- Use GitLab API v4. #29
- Use dep to vendor dependencies. #31
- dist: Windows binary is missing .exe suffix. #28
- Fixed segfault when from project has no milestones. #27
- Update go-gitlab library to v0.5.1. #21
Expand Down
2 changes: 1 addition & 1 deletion cmd/gitlab-copy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

const (
apiPath = "/api/v3"
apiPath = "/api/v4"
)

type issueRange struct {
Expand Down
8 changes: 4 additions & 4 deletions cmd/gitlab-copy/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (m *migration) migrateIssue(issueID int) error {
if err == nil {
for _, u := range users {
if u.Username == issue.Assignee.Username {
iopts.AssigneeID = &u.ID
iopts.AssigneeIDs = []int{u.ID}
break
}
}
Expand All @@ -152,7 +152,7 @@ func (m *migration) migrateIssue(issueID int) error {
cmopts := &gitlab.CreateMilestoneOptions{
Title: &issue.Milestone.Title,
Description: &issue.Milestone.Description,
DueDate: &issue.Milestone.DueDate,
DueDate: issue.Milestone.DueDate,
}
mi, _, err := target.Milestones.CreateMilestone(tarProjectID, cmopts)
if err == nil {
Expand Down Expand Up @@ -296,7 +296,7 @@ func (m *migration) migrate() error {
s := make([]issueId, 0)

// Copy all source labels on target
labels, _, err := source.Labels.ListLabels(srcProjectID)
labels, _, err := source.Labels.ListLabels(srcProjectID, nil)
if err != nil {
return fmt.Errorf("source: can't fetch labels: %s", err.Error())
}
Expand Down Expand Up @@ -327,7 +327,7 @@ func (m *migration) migrate() error {
cmopts := &gitlab.CreateMilestoneOptions{
Title: &mi.Title,
Description: &mi.Description,
DueDate: &mi.DueDate,
DueDate: mi.DueDate,
}
tmi, _, err := target.Milestones.CreateMilestone(tarProjectID, cmopts)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/gitlab-copy/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p *projectStats) computeStats(client *gitlab.Client) error {
case "closed":
p.nbClosed++
}
if issue.Milestone!=nil && issue.Milestone.Title != "" {
if issue.Milestone != nil && issue.Milestone.Title != "" {
p.milestones[issue.Milestone.Title]++
}
}
Expand All @@ -82,7 +82,7 @@ func (p *projectStats) computeStats(client *gitlab.Client) error {
return err
}

labels, _, err := client.Labels.ListLabels(p.project.ID)
labels, _, err := client.Labels.ListLabels(p.project.ID, nil)
if err != nil {
return fmt.Errorf("source: can't fetch labels: %s", err.Error())
}
Expand Down

0 comments on commit 20f1e5e

Please sign in to comment.