feat(pulls): support branch-validated stack reordering

Assisted-by: Codet:GPT-5-Codex
This commit is contained in:
Lunny Xiao
2026-09-24 23:31:32 -07:00
parent f28a5e696a
commit b06d902687
5 changed files with 103 additions and 1 deletions
+13
View File
@@ -120,6 +120,19 @@ func AddPullStackEntry(ctx stdctx.Context, login *config.Login, owner, repo stri
return &s, nil
}
// ReorderPullStack records the order of PR branches that are already linked.
func ReorderPullStack(ctx stdctx.Context, login *config.Login, owner, repo string, id int64, pullIndices []int64) (*stack.Stack, error) {
var s stack.Stack
err := postStackJSON(ctx, login, fmt.Sprintf("/repos/%s/%s/stacks/%d/reorder", owner, repo, id),
struct {
PullIndices []int64 `json:"pull_indices"`
}{PullIndices: pullIndices}, http.StatusOK, &s)
if err != nil {
return nil, err
}
return &s, nil
}
// RestackPullStack queues a restack starting at the stack's base branch.
func RestackPullStack(ctx stdctx.Context, login *config.Login, owner, repo string, id int64) error {
client := api.NewClient(login)