mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-05 21:38:13 +02:00
feat(pulls): add tea pr stack list|show|push|restack|merge
Adds a CLI client for the Gitea EE pull request stack API
(GET/POST /repos/{owner}/{repo}/stacks[/{id}[/entries|/restack|/merge]]):
- modules/stack holds the Stack/Entry/MergeResult types shared between
the API client and its output formatting, avoiding an import cycle
between modules/task and modules/print.
- modules/task/pull_stack.go implements the HTTP calls on top of
modules/api.Client, which gains a context-aware DoContext method.
- modules/print/pull_stack.go formats stack listings (table/json/...)
and a single stack's ordered entries.
- cmd/pulls/stack adds the list, show, push, restack and merge
subcommands, wired in as 'tea pr stack' via cmd/pulls.go, following
the repo/login flag routing used by the rest of the pulls commands.
Assisted-by: Codet:GPT-5-Codex
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// Copyright 2026 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// Package stack holds the data types shared between the pull request stack API
|
||||
// client (modules/task) and its output formatting (modules/print).
|
||||
package stack
|
||||
|
||||
// Entry is one pull request participating in a pull request stack.
|
||||
type Entry struct {
|
||||
PullID int64 `json:"pull_id"`
|
||||
ParentPullID int64 `json:"parent_pull_id"`
|
||||
Position int `json:"position"`
|
||||
State string `json:"state"`
|
||||
LastRestackedSHA string `json:"last_restacked_sha"`
|
||||
}
|
||||
|
||||
// Stack is a same-repository chain of pull requests, bottom first.
|
||||
type Stack struct {
|
||||
ID int64 `json:"id"`
|
||||
RepoID int64 `json:"repo_id"`
|
||||
OwnerID int64 `json:"owner_id"`
|
||||
Title string `json:"title"`
|
||||
BaseBranch string `json:"base_branch"`
|
||||
State string `json:"state"`
|
||||
AutoRestack bool `json:"auto_restack"`
|
||||
Entries []Entry `json:"entries"`
|
||||
}
|
||||
|
||||
// MergeResult reports how many pull requests of a stack were merged.
|
||||
type MergeResult struct {
|
||||
Merged int64 `json:"merged"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user