diff --git a/api/queries_branch_issue_reference.go b/api/queries_branch_issue_reference.go index c14f4c800..2dd9cffcc 100644 --- a/api/queries_branch_issue_reference.go +++ b/api/queries_branch_issue_reference.go @@ -1,5 +1,7 @@ package api +import "fmt" + type BranchIssueReference struct { ID int BranchName string @@ -10,25 +12,19 @@ type BranchIssueReference struct { func CreateBranchIssueReference(client *Client, repo *Repository, params map[string]interface{}) (*BranchIssueReference, error) { query := ` - mutation BranchIssueReferenceCreate($input: CreateBranchIssueReferenceInput!) { - mutation($issueId: ID!, $oid: GitObjectID!, $name: String, $repositoryId: ID) { + mutation CreateLinkedBranch($issueId: ID!, $oid: GitObjectID!, $name: String, $repositoryId: ID) { createLinkedBranch(input: { issueId: $issueId, name: $name, - oid: $oid + oid: $oid, repositoryId: $repositoryId }) { linkedBranch { - ref { - name - repository { - name - } - } + id } } } - }` + ` inputParams := map[string]interface{}{ "repositoryId": repo.ID, @@ -39,9 +35,6 @@ func CreateBranchIssueReference(client *Client, repo *Repository, params map[str inputParams[key] = val } } - variables := map[string]interface{}{ - "input": inputParams, - } result := struct { createLinkedBranch struct { @@ -49,7 +42,8 @@ func CreateBranchIssueReference(client *Client, repo *Repository, params map[str } }{} - err := client.GraphQL(repo.RepoHost(), query, variables, &result) + fmt.Printf("query variables %#v", inputParams) + err := client.GraphQL(repo.RepoHost(), query, inputParams, &result) if err != nil { return nil, err } diff --git a/api/queries_pr.go b/api/queries_pr.go index 18217a583..99f054b28 100644 --- a/api/queries_pr.go +++ b/api/queries_pr.go @@ -295,10 +295,7 @@ func CreatePullRequest(client *Client, repo *Repository, params map[string]inter inputParams[key] = val } } - variables := map[string]interface{}{ - "input": inputParams, - } - + variables := inputParams result := struct { CreatePullRequest struct { PullRequest PullRequest diff --git a/pkg/cmd/issue/develop/develop.go b/pkg/cmd/issue/develop/develop.go index 95be27218..26c832ab5 100644 --- a/pkg/cmd/issue/develop/develop.go +++ b/pkg/cmd/issue/develop/develop.go @@ -63,22 +63,17 @@ func NewCmdDevelop(f *cmdutil.Factory, runF func(*DevelopOptions) error) *cobra. } func developRun(opts *DevelopOptions) (err error) { - fmt.Printf("starting\n") httpClient, err := opts.HttpClient() if err != nil { return err } - fmt.Fprintf(opts.IO.ErrOut, "got the http client\n") apiClient := api.NewClientFromHTTP(httpClient) baseRepo, err := opts.BaseRepo() if err != nil { return err } - fmt.Fprintf(opts.IO.ErrOut, "got the baseRepo") opts.IO.StartProgressIndicator() - fmt.Fprintf(opts.IO.ErrOut, "running") repo, err := api.GitHubRepo(apiClient, baseRepo) - fmt.Fprintf(opts.IO.ErrOut, "found your repo %s\n", repo.Name) if err != nil { return err } @@ -88,9 +83,12 @@ func developRun(opts *DevelopOptions) (err error) { return err } - fmt.Fprintf(opts.IO.ErrOut, "found %s for ref %s, and found default branch oid %s\n", oid, opts.BaseBranch, default_branch_oid) + if oid == "" { + oid = default_branch_oid + } + // get the id of the issue repo - issue, _, err := shared.IssueFromArgWithFields(httpClient, opts.BaseRepo, opts.IssueNumber, []string{"id", "number", "title", "state"}) + issue, _, err := shared.IssueFromArgWithFields(httpClient, opts.BaseRepo, opts.IssueSelector, []string{"id", "number", "title"}) if err != nil { return err } diff --git a/pkg/cmd/issue/develop/develop_test.go b/pkg/cmd/issue/develop/develop_test.go new file mode 100644 index 000000000..41f3cbd37 --- /dev/null +++ b/pkg/cmd/issue/develop/develop_test.go @@ -0,0 +1,7 @@ +package develop + +import "testing" + +func TestNewCmdDevelop(t *testing.T) { + +}