Documentation
¶
Overview ¶
Package pluck provides functionality for extracting a single branch from a stack.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Deps ¶ added in v0.30.1
type Deps struct {
Engine Engine
Log output.Logger
actions.MutationDeps
}
Deps are the collaborators pluck needs. Adapters build them from their own runtime state; the action never sees bootstrap types.
type Engine ¶ added in v0.30.1
type Engine interface {
validation.BranchValidationEngine
actions.OwnershipEngine
Trunk() engine.Branch
IsTrunk(branch engine.Branch) bool
Graph(ctx context.Context, strategy engine.SortStrategy) *engine.StackGraph
GetAllCommits(ctx context.Context, branch engine.Branch) (git.Commits, error)
BatchRevisions(ctx context.Context, branches engine.Branches) engine.RevisionMap
GetDivergencePoint(ctx context.Context, branchName string) (string, error)
BatchDivergencePoints(ctx context.Context, branches engine.Branches) engine.RevisionMap
ValidateRebases(ctx context.Context, specs []engine.RebaseSpec) (*engine.RebaseValidation, error)
ReparentBranchesToParents(ctx context.Context, moves []engine.BranchParentMove, opts engine.ReparentOpts) error
AssignBranchesToNewStack(ctx context.Context, root engine.Branch, branches engine.Branches) (string, error)
}
Engine lists exactly the engine methods pluck calls.
type Handler ¶
type Handler interface {
// Start is called at the beginning of pluck
Start(move basehandler.Reparent)
// OnStep is called for each step in the pluck process
OnStep(step Step, status basehandler.StepStatus, message string)
// OnChildReparented is called when a child is reparented to the grandparent
OnChildReparented(move basehandler.Reparent)
// Complete is called when pluck finishes
Complete(result Result)
// Cleanup restores terminal state (may be no-op)
Cleanup()
// IsInteractive returns true if the handler supports interactive prompts
IsInteractive() bool
// PromptConfirmPluck displays a preview of the pluck and asks for confirmation.
// Returns true to proceed with the pluck, false to cancel.
// In non-interactive mode, returns true (auto-confirm).
PromptConfirmPluck(preview Preview) (bool, error)
}
Handler receives events from pluck action
type NullHandler ¶
type NullHandler struct {
basehandler.NullBase
basehandler.NullProgress[Step]
}
NullHandler is a no-op handler for when nil is passed. It embeds basehandler.NullBase for Cleanup() and IsInteractive(), and basehandler.NullProgress[Step] for OnStep().
func (*NullHandler) OnChildReparented ¶
func (h *NullHandler) OnChildReparented(basehandler.Reparent)
OnChildReparented implements Handler.
func (*NullHandler) PromptConfirmPluck ¶
func (h *NullHandler) PromptConfirmPluck(Preview) (bool, error)
PromptConfirmPluck implements Handler. Returns true (auto-confirm) for null handler.
func (*NullHandler) Start ¶
func (h *NullHandler) Start(basehandler.Reparent)
Start implements Handler.
type Options ¶
type Options struct {
Source string // Branch to pluck (defaults to current branch)
Onto string // Branch to pluck onto
SkipConfirm bool // Skip confirmation prompt (--yes flag)
}
Options contains options for the pluck command
type Preview ¶
type Preview struct {
SourceBranch string // Branch being plucked
OldParent string // Current parent of source
NewParent string // Target parent for source
Children []string // Direct children that will be reparented
ChildNewParent string // Where children will be reparented (grandparent)
Commits []string // Commit subjects on the source branch
}
Preview contains information about the planned pluck for confirmation