merge

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package merge defines merge transaction lifecycle operations.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingPreviewBinding reports an incomplete preview binding.
	ErrMissingPreviewBinding = repository.ErrMissingMergePreviewBinding
	// ErrMissingTransactionID reports an empty merge transaction ID.
	ErrMissingTransactionID = repository.ErrMissingMergeTransactionID
	// ErrStalePreview reports a preview whose branch state has changed.
	ErrStalePreview = repository.ErrStaleMergePreview
	// ErrConflicted reports a merge requiring resolution.
	ErrConflicted = repository.ErrMergeConflicted
	// ErrLeaseHeldByOther reports a target transaction owned by another caller.
	ErrLeaseHeldByOther = repository.ErrMergeLeaseHeldByOther
	// ErrOperationNotOwner reports an operation from a non-owning transaction.
	ErrOperationNotOwner = repository.ErrMergeOperationNotOwner
	// ErrNotInProgress reports a missing merge transaction.
	ErrNotInProgress = repository.ErrMergeNotInProgress
	// ErrResolutionIncomplete reports finalization before required resolution steps.
	ErrResolutionIncomplete = repository.ErrMergeResolutionIncomplete
	// ErrStagedSnapshotMissing reports an unknown resolution snapshot.
	ErrStagedSnapshotMissing = repository.ErrMergeStagedSnapshotMissing
	// ErrTargetLeaseHeld reports a branch mutation blocked by a merge lease.
	ErrTargetLeaseHeld = repository.ErrMergeTargetLeaseHeld
)

Functions

This section is empty.

Types

type ObjectID

type ObjectID = repository.ObjectID

ObjectID is the durable identifier used by repository merge operations.

type PreviewBinding

type PreviewBinding struct {
	// MergeBase is the common ancestor used to create the preview.
	MergeBase ObjectID
	// SourceCommit is the source head inspected by the preview.
	SourceCommit ObjectID
	// TargetCommit is the target head inspected by the preview.
	TargetCommit ObjectID
}

PreviewBinding pins the commits inspected by a merge preview.

type Service

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

Service coordinates merge transaction lifecycle requests.

func NewService

func NewService(store Store) Service

NewService returns a merge lifecycle service backed by store.

func (Service) Abort

func (s Service) Abort(target, transactionID string) error

Abort removes an owning merge transaction.

func (Service) ApplyClean

func (s Service) ApplyClean(source, target, transactionID string, binding PreviewBinding) (ObjectID, error)

ApplyClean validates and applies a clean preview-bound merge.

func (Service) ApplyConflicted

func (s Service) ApplyConflicted(source, target, transactionID string, binding PreviewBinding) error

ApplyConflicted records a conflicted preview-bound merge transaction.

func (Service) ApplyPreview

func (s Service) ApplyPreview(source, target, transactionID string, previewID ObjectID, author, message string) (ObjectID, error)

ApplyPreview applies a reviewed clean preview using caller commit metadata.

func (Service) Conflicts

func (s Service) Conflicts(target, transactionID string) (repository.MergeTransactionStatus, error)

Conflicts returns the persisted conflicted preview and current resolution state.

func (Service) Finalize

func (s Service) Finalize(target, transactionID string) (ObjectID, error)

Finalize commits a resolved and restaged transaction.

func (Service) Preview

func (s Service) Preview(source, target string) (repository.MergePreview, error)

Preview computes a deterministic merge preview without changing branch refs.

func (Service) Resolve

func (s Service) Resolve(target, transactionID string, stagedSnapshot ObjectID) error

Resolve records the snapshot produced by resolving a transaction.

func (Service) ResolveConflicts

func (s Service) ResolveConflicts(request repository.ResolveConflictedMergeRequest) error

ResolveConflicts records a complete, validated conflict resolution.

func (Service) Restage

func (s Service) Restage(target, transactionID string) error

Restage records that a transaction's resolution was restaged.

type Store

type Store interface {
	// PreviewMerge computes an immutable three-way merge without moving refs.
	PreviewMerge(string, string) (repository.MergePreview, error)
	// ApplyMergePreview recomputes and applies an exact clean preview.
	ApplyMergePreview(string, string, string, repository.ObjectID, string, string) (repository.ObjectID, error)
	// ApplyCleanBoundMerge validates a preview binding and commits a clean merge.
	ApplyCleanBoundMerge(string, string, string, repository.MergePreviewBinding) (repository.ObjectID, error)
	// ApplyConflictedBoundMerge records a conflicted merge transaction.
	ApplyConflictedBoundMerge(string, string, string, repository.MergePreviewBinding) error
	// InspectMergeTransaction returns the persisted conflicted preview to its owner.
	InspectMergeTransaction(string, string) (repository.MergeTransactionStatus, error)
	// ResolveConflictedMerge records a complete, validated conflict resolution.
	ResolveConflictedMerge(repository.ResolveConflictedMergeRequest) error
	// ResolveMergeTransaction records an owning transaction's resolution snapshot.
	ResolveMergeTransaction(string, string, repository.ObjectID) error
	// RestageMergeTransaction records that an owning transaction was restaged.
	RestageMergeTransaction(string, string) error
	// FinalizeMergeTransaction commits and removes a completed transaction.
	FinalizeMergeTransaction(string, string) (repository.ObjectID, error)
	// AbortMergeTransaction removes an owning transaction.
	AbortMergeTransaction(string, string) error
}

Store is the durable repository contract required by merge lifecycle operations. Repository owns atomic mutation and recovery; this package owns the merge-facing operation boundary.

Jump to

Keyboard shortcuts

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