cherrypick

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cherrypick defines operations for selectively transplanting commits onto target branches.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCommitRequired reports a cherry-pick request without a source commit hash.
	ErrCommitRequired = errors.New("cherry-pick commit is required")
	// ErrTargetBranchRequired reports a cherry-pick request without a target branch.
	ErrTargetBranchRequired = branch.ErrRequired
	// ErrConflicts reports that the cherry-pick produces property or structural conflicts against the target branch.
	ErrConflicts = errors.New("cherry-pick contains conflicts")
)

Functions

This section is empty.

Types

type Change

type Change struct {
	Entity string `json:"entity"`
	ID     string `json:"id"`
	Change string `json:"change"`
}

Change describes an entity changed from the target snapshot by a cherry-pick.

type Conflict

type Conflict struct {
	ConflictID string   `json:"conflictId"`
	Category   string   `json:"category"`
	Entity     string   `json:"entity"`
	ID         string   `json:"id,omitempty"`
	Field      string   `json:"field,omitempty"`
	Paths      []string `json:"paths"`
}

Conflict describes a deterministic three-way merge disagreement during cherry-picking.

type Request

type Request struct {
	// Commit identifies the source commit hash whose delta will be transplanted.
	Commit string `json:"commit"`
	// TargetBranch identifies the branch onto which the commit delta will be applied.
	TargetBranch string `json:"targetBranch"`
	// DryRun reports whether to simulate cherry-picking without writing commits or advancing branch refs.
	DryRun bool `json:"dryRun,omitempty"`
	// Author optionally overrides the commit author for non-dry-run executions.
	Author string `json:"author,omitempty"`
	// Message optionally overrides the commit message for non-dry-run executions.
	Message string `json:"message,omitempty"`
}

Request describes the options for a cherry-pick transplantation operation.

type Result

type Result struct {
	// TargetBranch identifies the branch targeted by the cherry-pick.
	TargetBranch string `json:"targetBranch"`
	// SourceCommit identifies the source commit that was transplanted.
	SourceCommit string `json:"sourceCommit"`
	// Commit identifies the newly created commit, or the unchanged target head when dry-run or no-op.
	Commit string `json:"commit,omitempty"`
	// DryRun indicates whether this result was produced by a preview simulation.
	DryRun bool `json:"dryRun,omitempty"`
	// Changes contains the entities added, modified, or removed relative to the target branch head.
	Changes []Change `json:"changes"`
	// Conflicts lists any structural or property collisions detected against the target branch.
	Conflicts []Conflict `json:"conflicts,omitempty"`
	// Violations lists any schema rule violations detected on the candidate target snapshot.
	Violations []SchemaViolation `json:"violations,omitempty"`
}

Result summarizes the transplanted changes, resulting commit, conflicts, and schema violations.

type SchemaViolation

type SchemaViolation struct {
	Code     string `json:"code"`
	Entity   string `json:"entity"`
	EntityID string `json:"entityID"`
	Rule     string `json:"rule,omitempty"`
	Field    string `json:"field,omitempty"`
	Expected string `json:"expected,omitempty"`
	Actual   string `json:"actual,omitempty"`
}

SchemaViolation describes a schema rule or constraint failure.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service validates cherry-pick requests and delegates execution to Store.

func NewService

func NewService(store Store) Service

NewService returns a cherry-pick service backed by store.

func (Service) CherryPick

func (s Service) CherryPick(ctx context.Context, request Request) (Result, error)

CherryPick validates the request, honors context cancellation, and executes cherry-pick through Store.

type Store

type Store interface {
	// CherryPick performs commit diff delta computation, 3-way property merging,
	// referential preflight verification, and atomic commit generation.
	CherryPick(request Request) (Result, error)
}

Store provides the repository-level cherry-pick persistence operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL