Remove convertRepoInterfaceToRepository

This commit is contained in:
Corey Johnson 2020-05-20 11:19:31 -07:00
parent 5d99c56456
commit 46a1e3cd53
3 changed files with 4 additions and 26 deletions

View file

@ -84,6 +84,9 @@ func GitHubRepo(client *Client, repo ghrepo.Interface) (*Repository, error) {
hasIssuesEnabled
description
viewerPermission
defaultBranchRef {
name
}
}
}`
variables := map[string]interface{}{

View file

@ -526,7 +526,6 @@ func prMerge(cmd *cobra.Command, args []string) error {
if err != nil {
return nil
}
}
var action string
@ -551,7 +550,7 @@ func prMerge(cmd *cobra.Command, args []string) error {
fmt.Fprintf(colorableOut(cmd), "%s %s pull request #%d\n", utils.Magenta("✔"), action, pr.Number)
if deleteBranch {
repo, err := convertRepoInterfaceToRepository(ctx, baseRepo)
repo, err := api.GitHubRepo(apiClient, baseRepo)
if err != nil {
return err
}

View file

@ -249,30 +249,6 @@ func determineBaseRepo(apiClient *api.Client, cmd *cobra.Command, ctx context.Co
return baseRepo, nil
}
func convertRepoInterfaceToRepository(ctx context.Context, repo ghrepo.Interface) (*api.Repository, error) {
apiClient, err := apiClientForContext(ctx)
if err != nil {
return nil, err
}
remotes, err := ctx.Remotes()
if err != nil {
return nil, err
}
repoContext, err := context.ResolveRemotesToRepos(remotes, apiClient, "")
if err != nil {
return nil, err
}
baseRepo, err := repoContext.BaseRepo()
if err != nil {
return nil, err
}
return baseRepo, nil
}
func rootHelpFunc(command *cobra.Command, s []string) {
if command != RootCmd {
cobraDefaultHelpFunc(command, s)