Skip to content

Commit 6e9927d

Browse files
committed
rm update pr base logic, should all happen on server
1 parent 1a1f49f commit 6e9927d

4 files changed

Lines changed: 3 additions & 46 deletions

File tree

cmd/push.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,7 @@ func runPush(cfg *config.Config, opts *pushOptions) error {
152152
URL: newPR.URL,
153153
}
154154
} else {
155-
// Update base if needed
156-
if pr.BaseRefName != baseBranch {
157-
if err := client.UpdatePRBase(pr.ID, baseBranch); err != nil {
158-
cfg.Warningf("failed to update PR %s base: %v", cfg.PRLink(pr.Number, pr.URL), err)
159-
} else {
160-
cfg.Successf("Updated PR %s base to %s", cfg.PRLink(pr.Number, pr.URL), baseBranch)
161-
}
162-
} else {
163-
cfg.Printf("PR %s for %s is up to date", cfg.PRLink(pr.Number, pr.URL), b.Branch)
164-
}
155+
cfg.Printf("PR %s for %s is up to date", cfg.PRLink(pr.Number, pr.URL), b.Branch)
165156
if s.Branches[i].PullRequest == nil {
166157
s.Branches[i].PullRequest = &stack.PullRequestRef{
167158
Number: pr.Number,

internal/github/client_interface.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ type ClientOps interface {
88
FindAnyPRForBranch(branch string) (*PullRequest, error)
99
FindPRDetailsForBranch(branch string) (*PRDetails, error)
1010
CreatePR(base, head, title, body string, draft bool) (*PullRequest, error)
11-
UpdatePRBase(prID, newBase string) error
1211
DeleteStack() error
1312
}
1413

internal/github/github.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -185,31 +185,6 @@ func (c *Client) CreatePR(base, head, title, body string, draft bool) (*PullRequ
185185
}, nil
186186
}
187187

188-
// UpdatePRBase updates the base branch of a pull request.
189-
func (c *Client) UpdatePRBase(prID, newBase string) error {
190-
var mutation struct {
191-
UpdatePullRequest struct {
192-
PullRequest struct {
193-
ID string
194-
}
195-
} `graphql:"updatePullRequest(input: $input)"`
196-
}
197-
198-
type UpdatePullRequestInput struct {
199-
PullRequestID string `json:"pullRequestId"`
200-
BaseRefName string `json:"baseRefName"`
201-
}
202-
203-
variables := map[string]interface{}{
204-
"input": UpdatePullRequestInput{
205-
PullRequestID: prID,
206-
BaseRefName: newBase,
207-
},
208-
}
209-
210-
return c.gql.Mutate("UpdatePullRequest", &mutation, variables)
211-
}
212-
213188
// PRDetails holds enriched pull request data for display in the TUI.
214189
type PRDetails struct {
215190
Number int

internal/github/mock_client.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ type MockClient struct {
99
FindPRForBranchFn func(string) (*PullRequest, error)
1010
FindAnyPRForBranchFn func(string) (*PullRequest, error)
1111
FindPRDetailsForBranchFn func(string) (*PRDetails, error)
12-
CreatePRFn func(string, string, string, string, bool) (*PullRequest, error)
13-
UpdatePRBaseFn func(string, string) error
14-
DeleteStackFn func() error
12+
CreatePRFn func(string, string, string, string, bool) (*PullRequest, error)
13+
DeleteStackFn func() error
1514
}
1615

1716
// Compile-time check that MockClient satisfies ClientOps.
@@ -45,13 +44,6 @@ func (m *MockClient) CreatePR(base, head, title, body string, draft bool) (*Pull
4544
return nil, nil
4645
}
4746

48-
func (m *MockClient) UpdatePRBase(prID, newBase string) error {
49-
if m.UpdatePRBaseFn != nil {
50-
return m.UpdatePRBaseFn(prID, newBase)
51-
}
52-
return nil
53-
}
54-
5547
func (m *MockClient) DeleteStack() error {
5648
if m.DeleteStackFn != nil {
5749
return m.DeleteStackFn()

0 commit comments

Comments
 (0)