stacks

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchMetadata

type BranchMetadata = meta.Branch

BranchMetadata is metadata about a given branch. TODO: Delete this type alias and just use meta.Branch.

type SyncBranchOpts

type SyncBranchOpts struct {
	// The branch that is being synced (this should already be checked out).
	Branch string
	// The name of the parent branch
	Parent string
	// The base commit to use for the rebase (every commit *after* this one
	// will be replayed onto Parent).
	Base string
	// The strategy for performing the sync.
	// If the branch is already up-to-date, the sync will be a no-op and
	// strategy will be ignored.
	Strategy SyncStrategy
}

type SyncResult

type SyncResult struct {
	Status SyncStatus
	Hint   string
}

SyncResult is the result of a SyncBranch operation.

func SyncBranch

func SyncBranch(
	repo *git.Repo,
	opts *SyncBranchOpts,
) (*SyncResult, error)

SyncBranch synchronizes the currently checked-out branch with the parent. The target branch is said to be already synchronized (up-to-date) if the target branch contains all the commits from the parent branch.

func SyncContinue

func SyncContinue(repo *git.Repo, strategy SyncStrategy) (*SyncResult, error)

type SyncStatus

type SyncStatus int
const (
	// SyncAlreadyUpToDate indicates that the sync was a no-op because the
	// target branch was already up-to-date with its parent.
	SyncAlreadyUpToDate SyncStatus = iota
	// SyncUpdated indicates that the sync updated the target branch
	// (i.e., created a merge commit or performed a rebase).
	SyncUpdated SyncStatus = iota
	// SyncConflict indicates that there was a conflict while syncing the
	// target branch with its parent.
	SyncConflict SyncStatus = iota
	// SyncNotInProgress indicates that there was no sync in progress when
	// SyncContinue was invoked.
	SyncNotInProgress SyncStatus = iota
)

type SyncStrategy

type SyncStrategy int
const (
	// StrategyMergeCommit indicates that the sync should create a merge commit
	// from the parent branch onto the target branch.
	StrategyMergeCommit SyncStrategy = iota
	// StrategyRebase indicates that the sync should perform a rebase onto the
	// parent branch.
	StrategyRebase SyncStrategy = iota
)

Jump to

Keyboard shortcuts

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