undobranches

package
v12.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package undobranches restores the Git branches to a known snapshot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CategorizeInconsistentChanges

func CategorizeInconsistentChanges(changes undodomain.InconsistentChanges, config *configdomain.FullConfig) (perennials, features undodomain.InconsistentChanges)

func DetermineUndoBranchesProgram

func DetermineUndoBranchesProgram(beginBranchesSnapshot, endBranchesSnapshot gitdomain.BranchesSnapshot, undoablePerennialCommits []gitdomain.SHA, fullConfig *configdomain.FullConfig) program.Program

Types

type BranchChanges

type BranchChanges struct {
	// 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 undodomain.InconsistentChanges
	LocalAdded            gitdomain.LocalBranchNames
	LocalChanged          LocalBranchChange
	LocalRemoved          LocalBranchesSHAs
	// OmniChanges are changes where the local SHA and the remote SHA are identical before the change as well as after the change,
	OmniChanged 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
	// OmniRemoved is when a branch that has the same SHA on its local and tracking branch gets removed.
	OmniRemoved   LocalBranchesSHAs
	RemoteAdded   gitdomain.RemoteBranchNames
	RemoteChanged RemoteBranchChange
	RemoteRemoved RemoteBranchesSHAs
}

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) UndoProgram

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

type BranchChangesUndoProgramArgs

type BranchChangesUndoProgramArgs struct {
	BeginBranch              gitdomain.LocalBranchName
	Config                   *configdomain.FullConfig
	EndBranch                gitdomain.LocalBranchName
	UndoablePerennialCommits []gitdomain.SHA
}

type BranchSpan

type BranchSpan struct {
	Before gitdomain.BranchInfo // the status of the branch before Git Town ran
	After  gitdomain.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 gitdomain.BranchesSnapshot) BranchSpans

func (BranchSpans) Changes

func (self BranchSpans) Changes() BranchChanges

Changes describes the specific changes made in this BranchSpans.

type LocalBranchChange

type LocalBranchChange map[gitdomain.LocalBranchName]undodomain.Change[gitdomain.SHA]

func CategorizeLocalBranchChange

func CategorizeLocalBranchChange(change LocalBranchChange, config *configdomain.FullConfig) (changedPerennials, changedFeatures LocalBranchChange)

func (LocalBranchChange) BranchNames

func (self LocalBranchChange) BranchNames() gitdomain.LocalBranchNames

type LocalBranchesSHAs

type LocalBranchesSHAs map[gitdomain.LocalBranchName]gitdomain.SHA

func (LocalBranchesSHAs) BranchNames

func (self LocalBranchesSHAs) BranchNames() gitdomain.LocalBranchNames

type RemoteBranchChange

type RemoteBranchChange map[gitdomain.RemoteBranchName]undodomain.Change[gitdomain.SHA]

func CategorizeRemoteBranchChange

func CategorizeRemoteBranchChange(change RemoteBranchChange, config *configdomain.FullConfig) (perennialChanges, featureChanges RemoteBranchChange)

func (RemoteBranchChange) BranchNames

func (self RemoteBranchChange) BranchNames() gitdomain.RemoteBranchNames

type RemoteBranchesSHAs

type RemoteBranchesSHAs map[gitdomain.RemoteBranchName]gitdomain.SHA

func CategorizeRemoteBranchesSHAs

func CategorizeRemoteBranchesSHAs(shas RemoteBranchesSHAs, config *configdomain.FullConfig) (perennials, features RemoteBranchesSHAs)

func (RemoteBranchesSHAs) BranchNames

func (self RemoteBranchesSHAs) BranchNames() gitdomain.RemoteBranchNames

BranchNames provides the names of the involved branches as strings.

Jump to

Keyboard shortcuts

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