Documentation
¶
Overview ¶
Package fold provides functionality for folding stacked branches.
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
actions.MutationDeps
}
Deps are the collaborators fold 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.GitOperationEngine
actions.OwnershipEngine
Trunk() engine.Branch
Graph(ctx context.Context, strategy engine.SortStrategy) *engine.StackGraph
GetRevision(ctx context.Context, branch engine.Branch) (string, error)
GetMergeBase(ctx context.Context, rev1, rev2 string) (string, error)
ShowDiff(ctx context.Context, rr git.RevRange, format git.DiffFormat) (string, error)
CheckoutBranch(ctx context.Context, branch engine.Branch) error
Merge(ctx context.Context, revision string, opts engine.MergeOptions) error
DeleteBranch(ctx context.Context, branch engine.Branch) error
SetParent(ctx context.Context, branch engine.Branch, parentBranch engine.Branch, mode engine.DivergenceMode) error
ReparentBranchesToParents(ctx context.Context, moves []engine.BranchParentMove, opts engine.ReparentOpts) error
}
Engine lists exactly the engine methods fold calls: the git-operation precondition checks, the merge/delete/reparent mutations, and the reads the dry-run preview needs.
type Handler ¶
type Handler interface {
// Start is called at the beginning of fold
Start(currentBranch, parentBranch string, dryRun bool)
// OnStep is called for each step in the fold process
OnStep(step Step, status handler.StepStatus, message string)
// Complete is called when fold finishes
Complete(result Result)
// Cleanup restores terminal state (may be no-op)
Cleanup()
// IsInteractive returns true if the handler supports interactive prompts
IsInteractive() bool
}
Handler receives events from fold action
type NullHandler ¶
type NullHandler struct {
handler.NullBase
handler.NullProgress[Step]
}
NullHandler is a no-op handler for when nil is passed. It embeds handler.NullBase for Cleanup() and IsInteractive().
type Options ¶
type Options struct {
Keep bool // If true, keeps the name of the current branch instead of using the name of its parent
AllowTrunk bool // If true, allows folding into the trunk branch
DryRun bool // If true, only shows what would happen
}
Options contains options for the fold command
Click to show internal directories.
Click to hide internal directories.