execute

package
v14.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package execute provides reusable high-level functionality shared by all Git Town commands but doesn't have a place in other subsystems because it needs to use many subsystems together.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureKnownBranchesAncestry

func EnsureKnownBranchesAncestry(args EnsureKnownBranchesAncestryArgs) error

EnsureKnownBranchesAncestry makes sure the entire repo lineage is known. If needed, it queries the user for missing information. It returns the updated version of all information that is derived from the lineage.

The purpose of this function is to implement proper cache invalidation. It ensures that all information derived from lineage gets updated when the lineage is updated.

func LoadRepoSnapshot

LoadRepoSnapshot loads the initial snapshot of the Git repo.

Types

type EnsureKnownBranchesAncestryArgs

type EnsureKnownBranchesAncestryArgs struct {
	BranchesToVerify gitdomain.LocalBranchNames
	Config           *config.Config
	DefaultChoice    gitdomain.LocalBranchName
	DialogTestInputs *components.TestInputs
	LocalBranches    gitdomain.BranchInfos
	MainBranch       gitdomain.LocalBranchName
	Runner           *git.ProdRunner
}

type FailureCollector

type FailureCollector struct {
	Err error `exhaustruct:"optional"`
}

FailureCollector helps avoid excessive error checking while gathering a larger number of values through fallible operations. This is based on ideas outlined in https://go.dev/blog/errors-are-values.

Please be aware that using this technique can lead to executing logic that would normally not run, using potentially invalid data, and potentially leading to unexpected runtime exceptions and side effects. Use with care and only if it's abundantly clear and obvious that there are no negative side effects. This is an anti-pattern in code to work arount an anti-pattern in the language.

func (*FailureCollector) BranchInfos

func (self *FailureCollector) BranchInfos(value gitdomain.BranchInfos, err error) gitdomain.BranchInfos

func (*FailureCollector) Check

func (self *FailureCollector) Check(err error) bool

Check registers the given error and indicates whether this ErrorChecker contains an error now.

func (*FailureCollector) Fail

func (self *FailureCollector) Fail(format string, a ...any)

Fail registers the error constructed using the given format arguments.

func (*FailureCollector) Remotes

func (self *FailureCollector) Remotes(value gitdomain.Remotes, err error) gitdomain.Remotes

Remotes provides the domain.Remotes part of the given fallible function result while registering the given error.

type LoadRepoSnapshotArgs

type LoadRepoSnapshotArgs struct {
	Config                *config.Config
	DialogTestInputs      components.TestInputs
	Fetch                 bool
	HandleUnfinishedState bool
	Repo                  *OpenRepoResult
	RepoStatus            gitdomain.RepoStatus
	ValidateIsConfigured  bool
	ValidateNoOpenChanges bool
	Verbose               bool
}

type OpenRepoArgs

type OpenRepoArgs struct {
	DryRun           bool
	OmitBranchNames  bool
	PrintCommands    bool
	ValidateGitRepo  bool
	ValidateIsOnline bool
	Verbose          bool
}

type OpenRepoResult

type OpenRepoResult struct {
	ConfigSnapshot undoconfig.ConfigSnapshot
	IsOffline      configdomain.Offline
	RootDir        gitdomain.RepoRootDir
	Runner         *git.ProdRunner
}

func OpenRepo

func OpenRepo(args OpenRepoArgs) (*OpenRepoResult, error)

Jump to

Keyboard shortcuts

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