execute

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: 17 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 EnsureKnownBranchAncestry

func EnsureKnownBranchAncestry(branch gitdomain.LocalBranchName, args EnsureKnownBranchAncestryArgs) error

EnsureKnownBranchAncestry makes sure the lineage for the given branch 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 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 EnsureKnownBranchAncestryArgs

type EnsureKnownBranchAncestryArgs struct {
	AllBranches      gitdomain.BranchInfos
	Config           *configdomain.FullConfig
	DefaultBranch    gitdomain.LocalBranchName
	DialogTestInputs *components.TestInputs
	Runner           *git.ProdRunner
}

type EnsureKnownBranchesAncestryArgs

type EnsureKnownBranchesAncestryArgs struct {
	Config           *configdomain.FullConfig
	DialogTestInputs *components.TestInputs
	LocalBranches    gitdomain.BranchInfos
	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 added in v12.0.1

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 added in v12.0.1

type LoadRepoSnapshotArgs struct {
	*configdomain.FullConfig
	DialogTestInputs      components.TestInputs
	Fetch                 bool
	HandleUnfinishedState bool
	Repo                  *OpenRepoResult
	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