Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/ci_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var ciTraceCmd = &cobra.Command{
},
}

func doTrace(ctx context.Context, w io.Writer, projID string, pipelineID int, name string) error {
func doTrace(ctx context.Context, w io.Writer, projID string, pipelineID int64, name string) error {
var (
once sync.Once
offset int64
Expand Down
2 changes: 1 addition & 1 deletion cmd/ci_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

var (
projectID string
pipelineID int
pipelineID int64
)

// ciViewCmd represents the ci command
Expand Down
8 changes: 4 additions & 4 deletions cmd/edit_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ import (
// GetUpdateUsers returns an int slice of user IDs based on the
// current users and flags from the command line, and a bool
// indicating whether the users have changed
func getUpdateUsers(currentUsers []string, users []string, remove []string) ([]int, bool, error) {
func getUpdateUsers(currentUsers []string, users []string, remove []string) ([]int64, bool, error) {
// add the new users to the current users, then remove the "remove" group
users = difference(union(currentUsers, users), remove)
usersChanged := !same(currentUsers, users)

// turn the new user list into a list of user IDs
var userIDs []int
var userIDs []int64
if usersChanged && len(users) == 0 {
// if we're removing all users, we have to use []int{0}
// see https://github.com/xanzy/go-gitlab/issues/427
userIDs = []int{0}
userIDs = []int64{0}
} else {
userIDs = make([]int, len(users))
userIDs = make([]int64, len(users))
for i, a := range users {
if getUserID(a) == nil {
return nil, false, fmt.Errorf("%s is not a valid username", a)
Expand Down
6 changes: 3 additions & 3 deletions cmd/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ var forkCmd = &cobra.Command{
if targetData.project != "" || targetData.group != "" ||
targetData.path != "" {
forkOpts = &gitlab.ForkProjectOptions{
Name: gitlab.String(targetData.project),
Namespace: gitlab.String(targetData.group),
Path: gitlab.String(targetData.path),
Name: gitlab.Ptr(targetData.project),
Namespace: gitlab.Ptr(targetData.group),
Path: gitlab.Ptr(targetData.path),
}
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/fork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
lab "github.com/zaquestion/lab/internal/gitlab"
gitlab "gitlab.com/gitlab-org/api/client-go"
)

func cleanupFork(t *testing.T, project string) {
Expand All @@ -20,7 +21,7 @@ func cleanupFork(t *testing.T, project string) {
if err != nil {
t.Fatal(errors.Wrap(err, "failed to find project "+project+" for cleanup"))
}
err = lab.ProjectDelete(p.ID)
err = lab.ProjectDelete(p.ID, &gitlab.DeleteProjectOptions{})
if err != nil {
t.Fatal(errors.Wrap(err, "failed to delete project "+project+" during cleanup"))
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/issue_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ var issueCloseCmd = &cobra.Command{
if !strings.Contains(dupID, "#") {
dupID = "#" + dupID
}
err = lab.IssueDuplicate(rn, int(id), dupID)
err = lab.IssueDuplicate(rn, id, dupID)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Issue #%d closed as duplicate of %s\n", id, dupID)
} else {
err = lab.IssueClose(rn, int(id))
err = lab.IssueClose(rn, id)
if err != nil {
log.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/issue_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"github.com/MakeNowJust/heredoc/v2"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
gitlab "gitlab.com/gitlab-org/api/client-go"
"github.com/zaquestion/lab/internal/action"
"github.com/zaquestion/lab/internal/git"
lab "github.com/zaquestion/lab/internal/gitlab"
gitlab "gitlab.com/gitlab-org/api/client-go"
)

var issueCreateCmd = &cobra.Command{
Expand Down Expand Up @@ -72,7 +72,7 @@ var issueCreateCmd = &cobra.Command{
log.Fatal(err)
}

var milestoneID *int
var milestoneID *int64
if milestoneName != "" {
milestone, err := lab.MilestoneGet(rn, milestoneName)
if err != nil {
Expand All @@ -95,7 +95,7 @@ var issueCreateCmd = &cobra.Command{
body = textToMarkdown(body)
}

assigneeIDs := make([]int, len(assignees))
assigneeIDs := make([]int64, len(assignees))
for i, a := range assignees {
assigneeIDs[i] = *getUserID(a)
}
Expand Down
17 changes: 8 additions & 9 deletions cmd/issue_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ package cmd

import (
"fmt"
"strconv"
"strings"

"github.com/MakeNowJust/heredoc/v2"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
gitlab "gitlab.com/gitlab-org/api/client-go"
"github.com/zaquestion/lab/internal/action"
lab "github.com/zaquestion/lab/internal/gitlab"
gitlab "gitlab.com/gitlab-org/api/client-go"
)

var issueEditCmd = &cobra.Command{
Expand All @@ -38,16 +37,16 @@ var issueEditCmd = &cobra.Command{
}

var (
issueNum int = 0
commentNum int = 0
issueNum int64 = 0
commentNum int64 = 0
)

if strings.Contains(idString, ":") {
ids := strings.Split(idString, ":")
issueNum, _ = strconv.Atoi(ids[0])
commentNum, _ = strconv.Atoi(ids[1])
issueNum, _ = Atoi(ids[0])
commentNum, _ = Atoi(ids[1])
} else {
issueNum, _ = strconv.Atoi(idString)
issueNum, _ = Atoi(idString)
}

issue, err := lab.IssueGet(rn, issueNum)
Expand All @@ -60,7 +59,7 @@ var issueEditCmd = &cobra.Command{
log.Fatal(err)
}
if deleteNote {
discussions, err := lab.IssueListDiscussions(rn, int(issueNum))
discussions, err := lab.IssueListDiscussions(rn, issueNum)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -145,7 +144,7 @@ var issueEditCmd = &cobra.Command{
log.Fatal(err)
}
updateMilestone := cmd.Flags().Lookup("milestone").Changed
milestoneID := -1
var milestoneID int64 = -1

if milestoneName != "" {
ms, err := lab.MilestoneGet(rn, milestoneName)
Expand Down
19 changes: 8 additions & 11 deletions cmd/issue_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/pkg/errors"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
gitlab "gitlab.com/gitlab-org/api/client-go"
"github.com/zaquestion/lab/internal/action"
lab "github.com/zaquestion/lab/internal/gitlab"
gitlab "gitlab.com/gitlab-org/api/client-go"
)

var (
Expand All @@ -25,7 +25,7 @@ var (
issueAssignee string
issueAssigneeID *gitlab.AssigneeIDValue
issueAuthor string
issueAuthorID *int
issueAuthorID *int64
issueOrder string
issueSortedBy string
)
Expand Down Expand Up @@ -113,28 +113,25 @@ func issueList(args []string) ([]*gitlab.Issue, error) {
log.Fatalf("%s user not found\n", issueAssignee)
}
issueAssigneeID = gitlab.AssigneeID(*assigneeID)
} else {
issueAssigneeID = nil
}

orderBy := gitlab.String(issueOrder)

sort := gitlab.String(issueSortedBy)
orderBy := gitlab.Ptr(issueOrder)

intIssueAssigneeID, err := strconv.Atoi(fmt.Sprintf("%v", issueAssigneeID))
if err != nil {
log.Fatalf("issueAssigneeID (%s) cannot be converted to int", issueAssigneeID)
}
sort := gitlab.Ptr(issueSortedBy)

opts := gitlab.ListProjectIssuesOptions{
ListOptions: gitlab.ListOptions{
PerPage: num,
PerPage: int64(num),
},
Labels: &labels,
Milestone: &issueMilestone,
State: &issueState,
OrderBy: orderBy,
Sort: sort,
AuthorID: issueAuthorID,
AssigneeID: &intIssueAssigneeID,
AssigneeID: issueAssigneeID,
}

if issueExactMatch {
Expand Down
3 changes: 1 addition & 2 deletions cmd/issue_move.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"fmt"
"strconv"

"github.com/rsteube/carapace"
"github.com/spf13/cobra"
Expand All @@ -25,7 +24,7 @@ var issueMoveCmd = &cobra.Command{
}

// get the issue ID
id, err := strconv.Atoi(args[0])
id, err := Atoi(args[0])
if err != nil {
log.Fatal(err)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/issue_reopen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"

"github.com/MakeNowJust/heredoc/v2"

"github.com/rsteube/carapace"
Expand All @@ -23,7 +24,7 @@ var issueReopenCmd = &cobra.Command{
log.Fatal(err)
}

err = lab.IssueReopen(rn, int(id))
err = lab.IssueReopen(rn, id)
if err != nil {
log.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/issue_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var issueShowCmd = &cobra.Command{
log.Fatalf("Specify <id> of issue to be shown")
}

issue, err := lab.IssueGet(rn, int(issueNum))
issue, err := lab.IssueGet(rn, issueNum)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -69,7 +69,7 @@ var issueShowCmd = &cobra.Command{
}

if noteLevel != NoteLevelNone {
discussions, err := lab.IssueListDiscussions(rn, int(issueNum))
discussions, err := lab.IssueListDiscussions(rn, issueNum)
if err != nil {
log.Fatal(err)
}
Expand All @@ -79,7 +79,7 @@ var issueShowCmd = &cobra.Command{
log.Fatal(err)
}

printDiscussions(rn, discussions, since, "issues", int(issueNum), renderMarkdown, noteLevel)
printDiscussions(rn, discussions, since, "issues", issueNum, renderMarkdown, noteLevel)
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/issue_subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var issueSubscribeCmd = &cobra.Command{
log.Fatal(err)
}

err = lab.IssueSubscribe(rn, int(id))
err = lab.IssueSubscribe(rn, id)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/issue_unsubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var issueUnsubscribeCmd = &cobra.Command{
log.Fatal(err)
}

err = lab.IssueUnsubscribe(rn, int(id))
err = lab.IssueUnsubscribe(rn, id)
if err != nil {
log.Fatal(err)
}
Expand Down
11 changes: 6 additions & 5 deletions cmd/mr_approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package cmd

import (
"fmt"
"os"

"github.com/MakeNowJust/heredoc/v2"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
"github.com/zaquestion/lab/internal/action"
lab "github.com/zaquestion/lab/internal/gitlab"
"os"
)

var mrApproveCmd = &cobra.Command{
Expand All @@ -27,7 +28,7 @@ var mrApproveCmd = &cobra.Command{
log.Fatal(err)
}

approvalConfig, err := lab.GetMRApprovalsConfiguration(rn, int(id))
approvalConfig, err := lab.GetMRApprovalsConfiguration(rn, id)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -62,14 +63,14 @@ var mrApproveCmd = &cobra.Command{
log.Fatal(err)
}
if comment {
state := noteGetState(rn, true, int(id))
msg, _ := noteMsg(msgs, true, int(id), state, "", "")
state := noteGetState(rn, true, id)
msg, _ := noteMsg(msgs, true, id, state, "", "")
msgs = append(msgs, msg)
}
}

msgs = append(msgs, "/approve")
createNote(rn, true, int(id), msgs, filename, linebreak, "", note)
createNote(rn, true, id, msgs, filename, linebreak, "", note)

fmt.Printf("Merge Request !%d approved\n", id)
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var checkoutCmd = &cobra.Command{
targetRemote = args[0]
}

mr, err := lab.MRGet(rn, int(mrID))
mr, err := lab.MRGet(rn, mrID)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var mrCloseCmd = &cobra.Command{
log.Fatal(err)
}

err = lab.MRClose(rn, int(id))
err = lab.MRClose(rn, id)
if err != nil {
log.Fatal(err)
}
Expand Down
Loading