Skip to content

Commit

Permalink
Merge branch 'daytonaio:main' into git-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborg-031 authored Sep 26, 2024
2 parents 2a4016c + cfe1803 commit 93b727b
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions pkg/gitprovider/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func (g *BitbucketGitProvider) GetRepositories(namespace string) ([]*GitReposito

repoList, err := client.Repositories.ListForAccount(&bitbucket.RepositoriesOptions{
Owner: namespace,
Page: &[]int{1}[0],
Keyword: nil,
})
if err != nil {
Expand Down Expand Up @@ -150,17 +149,20 @@ func (g *BitbucketGitProvider) GetRepoPRs(repositoryId string, namespaceId strin
client := g.getApiClient()
var response []*GitPullRequest

fullName := fmt.Sprintf("%s/%s", namespaceId, repositoryId)
opts := &bitbucket.PullRequestsOptions{
RepoSlug: repositoryId,
Owner: namespaceId,
}

owner, repo, err := g.getOwnerAndRepoFromFullName(fullName)
if err != nil {
return nil, err
owner, repo, err := g.getOwnerAndRepoFromFullName(repositoryId)
if err == nil {
opts = &bitbucket.PullRequestsOptions{
RepoSlug: repo,
Owner: owner,
}
}

prList, err := client.Repositories.PullRequests.Get(&bitbucket.PullRequestsOptions{
Owner: owner,
RepoSlug: repo,
})
prList, err := client.Repositories.PullRequests.Get(opts)
if err != nil {
return nil, g.FormatError(err)
}
Expand Down Expand Up @@ -193,8 +195,8 @@ func (g *BitbucketGitProvider) GetRepoPRs(repositoryId string, namespaceId strin
Sha: pr.Source.Commit.Hash,
SourceRepoId: pr.Source.Repository.Full_name,
SourceRepoUrl: repoUrl,
SourceRepoOwner: owner,
SourceRepoName: repo,
SourceRepoOwner: opts.Owner,
SourceRepoName: opts.RepoSlug,
})
}

Expand Down

0 comments on commit 93b727b

Please sign in to comment.