Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommitRef no longer has the wrong fields #57

Closed
wants to merge 4 commits into from
Closed
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Visit the docs at http://godoc.org/github.com/plouc/go-gitlab-client/gitlab
- [ ] Post comment to commit
- [x] List the statuses of a commit
- [ ] Post the build status to a commit
- [ ] List Merge Requests associated with a commit
- [x] List Merge Requests associated with a commit

#### Deploy Keys

Expand Down
2 changes: 1 addition & 1 deletion README.tpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Visit the docs at http://godoc.org/github.com/plouc/go-gitlab-client/gitlab
- [ ] Post comment to commit
- [x] List the statuses of a commit
- [ ] Post the build status to a commit
- [ ] List Merge Requests associated with a commit
- [x] List Merge Requests associated with a commit

#### Deploy Keys

Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/get_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestGetCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/get_project_merge_request_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestGetProjectMergeRequestCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_groups_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListGroupsCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_merge_requests_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListMergeRequestsCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_project_environments_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListProjectEnvironmentsCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_project_issue_notes_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListProjectIssueNotesCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_project_merge_requests_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListProjectMergeRequestsCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_project_snippet_notes_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListProjectSnippetNotesCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_projects_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListProjectsCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_runners_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListRunnersCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_ssh_keys_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListSshKeysCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_user_ssh_keys_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListUserSshKeysCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/list_users_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestListUsersCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/root_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
)

func TestRootCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion gitlab/badges_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/branches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
20 changes: 18 additions & 2 deletions gitlab/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const (
ProjectCommitDiffApiPath = "/projects/:id/repository/commits/:sha/diff"
ProjectCommitRefsApiPath = "/projects/:id/repository/commits/:sha/refs"
ProjectCommitStatusesApiPath = "/projects/:id/repository/commits/:sha/statuses"
ProjectCommitMaergeRequestsApiPath = "/projects/:id/repository/commits/:sha/merge_requests"
)

type MinimalCommit struct {
Expand Down Expand Up @@ -153,8 +154,7 @@ func (g *Gitlab) ProjectCommit(projectId, commitSha string) (*Commit, *ResponseM
}

type CommitRef struct {
Id string `json:"id" yaml:"id"`
Sha string `json:"sha" yaml:"sha"`
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
}

Expand Down Expand Up @@ -235,3 +235,19 @@ func (g *Gitlab) ProjectCommitStatuses(projectId, sha string, o *PaginationOptio

return collection, meta, err
}

func (g *Gitlab) ProjectCommitMergeRequests(projectId, sha string, o *PaginationOptions) (*MergeRequestCollection, *ResponseMeta, error) {
u := g.ResourceUrlQ(ProjectCommitMaergeRequestsApiPath, map[string]string{
":id": projectId,
":sha": sha,
}, o)

collection := new(MergeRequestCollection)

contents, meta, err := g.buildAndExecRequest("GET", u.String(), nil)
if err == nil {
err = json.Unmarshal(contents, &collection.Items)
}

return collection, meta, err
}
2 changes: 1 addition & 1 deletion gitlab/commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/environments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/members_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/merge_requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/notes_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gitlab

import (
"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
"testing"
)
Expand Down
2 changes: 1 addition & 1 deletion gitlab/projects_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gitlab

import (
"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
"testing"
)
Expand Down
2 changes: 1 addition & 1 deletion gitlab/runners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/ssh_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gitlab
import (
"testing"

"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab/users_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gitlab

import (
"github.com/plouc/go-gitlab-client/test"
"github.com/edison-moreland/go-gitlab-client/test"
"github.com/stretchr/testify/assert"
"testing"
)
Expand Down