undo

package
v10.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUndoProgram

func CreateUndoProgram(args CreateUndoProgramArgs) (program.Program, error)

Types

type BranchChanges

type BranchChanges struct {
	LocalAdded    domain.LocalBranchNames
	LocalRemoved  domain.LocalBranchesSHAs
	LocalChanged  domain.LocalBranchChange
	RemoteAdded   domain.RemoteBranchNames
	RemoteRemoved domain.RemoteBranchesSHAs
	RemoteChanged domain.RemoteBranchChange
	// OmniRemoved is when a branch that has the same SHA on its local and tracking branch gets removed.
	OmniRemoved domain.LocalBranchesSHAs
	// OmniChanges are changes where the local SHA and the remote SHA are identical before the change as well as after the change,
	OmniChanged domain.LocalBranchChange // a branch had the same SHA locally and remotely, now it has a new SHA locally and remotely, the local and remote SHA are still equal
	// Inconsistent changes are changes on both local and tracking branch, but where the local and tracking branch
	// don't have the same SHA before or after.
	// These changes cannot be undone for perennial branches because there is no way to reset the remote branch to the SHA it had before.
	InconsistentlyChanged domain.InconsistentChanges
}

BranchChanges describes the changes made to the branches in a Git repo. Various types of changes are distinguished.

func EmptyBranchChanges

func EmptyBranchChanges() BranchChanges

EmptyBranchChanges provides a properly initialized empty Changes instance.

func (BranchChanges) String

func (self BranchChanges) String() string

func (BranchChanges) UndoProgram

UndoProgram provides the steps to undo the changes described by this BranchChanges instance.

type BranchChangesUndoProgramArgs

type BranchChangesUndoProgramArgs struct {
	Lineage                  config.Lineage
	BranchTypes              domain.BranchTypes
	InitialBranch            domain.LocalBranchName
	FinalBranch              domain.LocalBranchName
	NoPushHook               bool
	UndoablePerennialCommits []domain.SHA
}

type BranchSpan

type BranchSpan struct {
	Before domain.BranchInfo // the status of the branch before Git Town ran
	After  domain.BranchInfo // the status of the branch after Git Town ran
}

BranchSpan represents changes of a branch over time.

func (BranchSpan) IsInconsistentChange

func (self BranchSpan) IsInconsistentChange() bool

func (BranchSpan) IsOmniChange

func (self BranchSpan) IsOmniChange() bool

IsOmniChange indicates whether this BranchBeforeAfter changes a synced branch from one SHA both locally and remotely to another SHA both locally and remotely.

func (BranchSpan) IsOmniRemove

func (self BranchSpan) IsOmniRemove() bool

func (BranchSpan) LocalAdded

func (self BranchSpan) LocalAdded() bool

func (BranchSpan) LocalChanged

func (self BranchSpan) LocalChanged() bool

func (BranchSpan) LocalRemoved

func (self BranchSpan) LocalRemoved() bool

func (BranchSpan) NoChanges

func (self BranchSpan) NoChanges() bool

NoChanges indicates whether this BranchBeforeAfter contains changes or not.

func (BranchSpan) RemoteAdded

func (self BranchSpan) RemoteAdded() bool

func (BranchSpan) RemoteChanged

func (self BranchSpan) RemoteChanged() bool

func (BranchSpan) RemoteRemoved

func (self BranchSpan) RemoteRemoved() bool

type BranchSpans

type BranchSpans []BranchSpan

BranchSpans describes how a Git Town command has modified the branches in a Git repository.

func NewBranchSpans

func NewBranchSpans(beforeSnapshot, afterSnapshot domain.BranchesSnapshot) BranchSpans

func (BranchSpans) Changes

func (self BranchSpans) Changes() BranchChanges

Changes describes the specific changes made in this BranchSpans.

type ConfigDiff

type ConfigDiff struct {
	Added   []config.Key
	Removed map[config.Key]string
	Changed map[config.Key]domain.Change[string]
}

ConfigDiff describes the changes made to the local or global Git configuration.

func EmptyConfigDiff

func EmptyConfigDiff() ConfigDiff

func NewConfigDiff

func NewConfigDiff(before, after config.GitConfigCache) ConfigDiff

type ConfigDiffs

type ConfigDiffs struct {
	Global ConfigDiff
	Local  ConfigDiff
}

ConfigDiffs describes the changes made to the local and global Git configuration.

func NewConfigDiffs

func NewConfigDiffs(before, after ConfigSnapshot) ConfigDiffs

func (ConfigDiffs) UndoProgram

func (self ConfigDiffs) UndoProgram() program.Program

type ConfigSnapshot

type ConfigSnapshot struct {
	Cwd       string // the current working directory
	GitConfig config.GitConfig
}

ConfigSnapshot is a snapshot of the Git configuration at a particular point in time.

type CreateUndoProgramArgs

type CreateUndoProgramArgs struct {
	Run                      *git.ProdRunner
	InitialBranchesSnapshot  domain.BranchesSnapshot
	InitialConfigSnapshot    ConfigSnapshot
	InitialStashSnapshot     domain.StashSnapshot
	NoPushHook               bool
	UndoablePerennialCommits []domain.SHA
}

type StashDiff

type StashDiff struct {
	// the number of entries added to the Git stash (positive = entries added, negative = entries removed, 0 = nothing added)
	EntriesAdded int
}

StashDiff describes the changes made to the Git stash.

func NewStashDiff

func NewStashDiff(before, after domain.StashSnapshot) StashDiff

func (StashDiff) Program

func (self StashDiff) Program() program.Program

Jump to

Keyboard shortcuts

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