configdomain

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: 12 Imported by: 0

Documentation

Overview

Package configdomain defines domain concepts and data types around Git Town configuration. These types exist in their own package because they are used in various places.

Index

Constants

View Source
const (
	AliasableCommandAppend       = AliasableCommand("append")
	AliasableCommandContribute   = AliasableCommand("contribute")
	AliasableCommandDiffParent   = AliasableCommand("diff-parent")
	AliasableCommandHack         = AliasableCommand("hack")
	AliasableCommandKill         = AliasableCommand("kill")
	AliasableCommandObserve      = AliasableCommand("observe")
	AliasableCommandPark         = AliasableCommand("park")
	AliasableCommandPrepend      = AliasableCommand("prepend")
	AliasableCommandPropose      = AliasableCommand("propose")
	AliasableCommandRenameBranch = AliasableCommand("rename-branch")
	AliasableCommandRepo         = AliasableCommand("repo")
	AliasableCommandSetParent    = AliasableCommand("set-parent")
	AliasableCommandShip         = AliasableCommand("ship")
	AliasableCommandSync         = AliasableCommand("sync")
)
View Source
const (
	HostingPlatformBitbucket = HostingPlatform("bitbucket")
	HostingPlatformGitHub    = HostingPlatform("github")
	HostingPlatformGitLab    = HostingPlatform("gitlab")
	HostingPlatformGitea     = HostingPlatform("gitea")
	HostingPlatformNone      = HostingPlatform("") // no hosting or auto-detect
)
View Source
const (
	SyncFeatureStrategyMerge  = SyncFeatureStrategy("merge")
	SyncFeatureStrategyRebase = SyncFeatureStrategy("rebase")
)
View Source
const (
	SyncPerennialStrategyMerge  = SyncPerennialStrategy("merge")
	SyncPerennialStrategyRebase = SyncPerennialStrategy("rebase")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasableCommand

type AliasableCommand string

AliasableCommand defines Git Town commands that can shortened via Git aliases.

func (AliasableCommand) String

func (self AliasableCommand) String() string

type AliasableCommands

type AliasableCommands []AliasableCommand

func AllAliasableCommands

func AllAliasableCommands() AliasableCommands

AllAliasableCommands provides all AliasType values.

func (AliasableCommands) Strings

func (self AliasableCommands) Strings() []string

type Aliases

type Aliases map[AliasableCommand]string

Aliases contains the Git Town releated Git aliases.

type BranchType added in v12.1.0

type BranchType int
const (
	BranchTypeMainBranch BranchType = iota
	BranchTypePerennialBranch
	BranchTypeFeatureBranch
	BranchTypeParkedBranch
	BranchTypeContributionBranch
	BranchTypeObservedBranch
)

func (BranchType) ShouldPush added in v12.1.0

func (self BranchType) ShouldPush(currentBranch, initialBranch gitdomain.LocalBranchName) bool

ShouldPush indicates whether a branch with this type should push its local commit to origin.

func (BranchType) String added in v12.1.0

func (self BranchType) String() string

type FullConfig

type FullConfig struct {
	Aliases                  Aliases
	ContributionBranches     gitdomain.LocalBranchNames
	GitHubToken              GitHubToken
	GitLabToken              GitLabToken
	GitUserEmail             string
	GitUserName              string
	GiteaToken               GiteaToken
	HostingOriginHostname    HostingOriginHostname
	HostingPlatform          HostingPlatform
	Lineage                  Lineage
	MainBranch               gitdomain.LocalBranchName
	ObservedBranches         gitdomain.LocalBranchNames
	Offline                  Offline
	ParkedBranches           gitdomain.LocalBranchNames
	PerennialBranches        gitdomain.LocalBranchNames
	PerennialRegex           PerennialRegex
	PushHook                 PushHook
	PushNewBranches          PushNewBranches
	ShipDeleteTrackingBranch ShipDeleteTrackingBranch
	SyncBeforeShip           SyncBeforeShip
	SyncFeatureStrategy      SyncFeatureStrategy
	SyncPerennialStrategy    SyncPerennialStrategy
	SyncUpstream             SyncUpstream
}

FullConfig is the merged configuration to be used by Git Town commands.

func DefaultConfig

func DefaultConfig() FullConfig

DefaultConfig provides the default configuration data to use when nothing is configured.

func (*FullConfig) BranchType added in v12.1.0

func (self *FullConfig) BranchType(branch gitdomain.LocalBranchName) BranchType

func (*FullConfig) ContainsLineage

func (self *FullConfig) ContainsLineage() bool

ContainsLineage indicates whether this configuration contains any lineage entries.

func (*FullConfig) IsContributionBranch added in v12.1.0

func (self *FullConfig) IsContributionBranch(branch gitdomain.LocalBranchName) bool

func (*FullConfig) IsMainBranch

func (self *FullConfig) IsMainBranch(branch gitdomain.LocalBranchName) bool

IsMainBranch indicates whether the branch with the given name is the main branch of the repository.

func (*FullConfig) IsMainOrPerennialBranch added in v12.1.0

func (self *FullConfig) IsMainOrPerennialBranch(branch gitdomain.LocalBranchName) bool

IsMainOrPerennialBranch indicates whether the branch with the given name is the main branch or a perennial branch of the repository.

func (*FullConfig) IsObservedBranch added in v12.1.0

func (self *FullConfig) IsObservedBranch(branch gitdomain.LocalBranchName) bool

func (*FullConfig) IsOnline

func (self *FullConfig) IsOnline() bool

func (*FullConfig) IsParkedBranch added in v12.1.0

func (self *FullConfig) IsParkedBranch(branch gitdomain.LocalBranchName) bool

func (*FullConfig) IsPerennialBranch

func (self *FullConfig) IsPerennialBranch(branch gitdomain.LocalBranchName) bool

func (*FullConfig) MainAndPerennials

func (self *FullConfig) MainAndPerennials() gitdomain.LocalBranchNames

func (*FullConfig) Merge

func (self *FullConfig) Merge(other PartialConfig)

Merges the given PartialConfig into this configuration object.

func (*FullConfig) NoPushHook

func (self *FullConfig) NoPushHook() NoPushHook

func (*FullConfig) Online

func (self *FullConfig) Online() Online

func (*FullConfig) ShouldPushNewBranches

func (self *FullConfig) ShouldPushNewBranches() bool

type GitHubToken

type GitHubToken string

GitHubToken is a bearer token to use with the GitHub API.

func NewGitHubTokenRef

func NewGitHubTokenRef(value string) *GitHubToken

func (GitHubToken) String

func (self GitHubToken) String() string

type GitLabToken

type GitLabToken string

GitLabToken is a bearer token to use with the GitLab API.

func NewGitLabTokenRef

func NewGitLabTokenRef(value string) *GitLabToken

func (GitLabToken) String

func (self GitLabToken) String() string

type GiteaToken

type GiteaToken string

GiteaToken is a bearer token to use with the Gitea API.

func NewGiteaTokenRef

func NewGiteaTokenRef(value string) *GiteaToken

func (GiteaToken) String

func (self GiteaToken) String() string

type HostingOriginHostname

type HostingOriginHostname string

func NewHostingOriginHostnameRef

func NewHostingOriginHostnameRef(value string) *HostingOriginHostname

func (HostingOriginHostname) String

func (self HostingOriginHostname) String() string

type HostingPlatform

type HostingPlatform string

HostingPlatform defines legal values for the "git-town.hosting-platform" config setting.

func NewHostingPlatform

func NewHostingPlatform(platformName string) (HostingPlatform, error)

NewHostingPlatform provides the HostingPlatform enum matching the given text.

func NewHostingPlatformRef

func NewHostingPlatformRef(platformName string) (*HostingPlatform, error)

NewHostingPlatformRef provides the HostingPlatform enum matching the given text.

func (HostingPlatform) String

func (self HostingPlatform) String() string

type Lineage

Lineage encapsulates all data and functionality around parent branches. branch --> its parent Lineage only contains branches that have ancestors.

func (Lineage) Ancestors

Ancestors provides the names of all parent branches of the branch with the given name.

func (Lineage) BranchAndAncestors

func (self Lineage) BranchAndAncestors(branchName gitdomain.LocalBranchName) gitdomain.LocalBranchNames

BranchAndAncestors provides the full lineage for the branch with the given name, including the branch.

func (Lineage) BranchNames

func (self Lineage) BranchNames() gitdomain.LocalBranchNames

BranchNames provides the names of all branches in this Lineage, sorted alphabetically.

func (Lineage) BranchesAndAncestors

func (self Lineage) BranchesAndAncestors(branchNames gitdomain.LocalBranchNames) gitdomain.LocalBranchNames

BranchesAndAncestors provides the full lineage for the branches with the given names, including the branches themselves.

func (Lineage) Children

Children provides the names of all branches that have the given branch as their parent.

func (Lineage) HasParents

func (self Lineage) HasParents(branch gitdomain.LocalBranchName) bool

HasParents returns whether or not the given branch has at least one parent.

func (Lineage) IsAncestor

func (self Lineage) IsAncestor(ancestor, other gitdomain.LocalBranchName) bool

IsAncestor indicates whether the given branch is an ancestor of the other given branch.

func (Lineage) OrderHierarchically

func (self Lineage) OrderHierarchically(branches gitdomain.LocalBranchNames)

OrderHierarchically sorts the given branches in place so that ancestor branches come before their descendants and everything is sorted alphabetically.

func (Lineage) Parent

Parent provides the name of the parent branch for the given branch or nil if the branch has no parent.

func (Lineage) RemoveBranch

func (self Lineage) RemoveBranch(branch gitdomain.LocalBranchName)

RemoveBranch removes the given branch completely from this lineage.

func (Lineage) Roots

func (self Lineage) Roots() gitdomain.LocalBranchNames

Roots provides the branches with children and no parents.

type NoPushHook

type NoPushHook bool

NoPushHook helps using the type checker to verify correct negation of the push-hook configuration setting.

func (NoPushHook) Bool

func (noPushHook NoPushHook) Bool() bool

type Offline

type Offline bool

Offline is a new-type for the "offline" configuration setting.

func NewOfflineRef

func NewOfflineRef(value, source string) (*Offline, error)

func (Offline) Bool

func (offline Offline) Bool() bool

func (Offline) String

func (offline Offline) String() string

func (Offline) ToOnline

func (offline Offline) ToOnline() Online

type Online

type Online bool

func (Online) Bool

func (online Online) Bool() bool

type OriginURLCache

type OriginURLCache map[string]*giturl.Parts

type PartialConfig

type PartialConfig struct {
	Aliases                  Aliases
	ContributionBranches     *gitdomain.LocalBranchNames
	GitHubToken              *GitHubToken
	GitLabToken              *GitLabToken
	GitUserEmail             *string
	GitUserName              *string
	GiteaToken               *GiteaToken
	HostingOriginHostname    *HostingOriginHostname
	HostingPlatform          *HostingPlatform
	Lineage                  *Lineage
	MainBranch               *gitdomain.LocalBranchName
	ObservedBranches         *gitdomain.LocalBranchNames
	Offline                  *Offline
	ParkedBranches           *gitdomain.LocalBranchNames
	PerennialBranches        *gitdomain.LocalBranchNames
	PerennialRegex           *PerennialRegex
	PushHook                 *PushHook
	PushNewBranches          *PushNewBranches
	ShipDeleteTrackingBranch *ShipDeleteTrackingBranch
	SyncBeforeShip           *SyncBeforeShip
	SyncFeatureStrategy      *SyncFeatureStrategy
	SyncPerennialStrategy    *SyncPerennialStrategy
	SyncUpstream             *SyncUpstream
}

PartialConfig contains configuration data as it is stored in the local or global Git configuration.

func EmptyPartialConfig

func EmptyPartialConfig() PartialConfig

type PerennialRegex added in v12.1.0

type PerennialRegex string

PerennialRegex contains the "branches.perennial-regex" setting.

func NewPerennialRegexRef added in v12.1.0

func NewPerennialRegexRef(value string) *PerennialRegex

func (PerennialRegex) MatchesBranch added in v12.1.0

func (self PerennialRegex) MatchesBranch(branch gitdomain.LocalBranchName) bool

MatchesBranch indicates whether the given branch matches this PerennialRegex.

func (PerennialRegex) String added in v12.1.0

func (self PerennialRegex) String() string

type PushHook

type PushHook bool

PushHook contains the push-hook configuration setting.

func NewPushHook

func NewPushHook(value, source string) (PushHook, error)

func NewPushHookRef

func NewPushHookRef(value, source string) (*PushHook, error)

func (PushHook) Bool

func (pushHook PushHook) Bool() bool

func (PushHook) Negate

func (pushHook PushHook) Negate() NoPushHook

func (PushHook) String

func (pushHook PushHook) String() string

type PushNewBranches

type PushNewBranches bool

PushNewBranches indicates whether newly created branches should be pushed to the remote or not.

func NewPushNewBranchesRef

func NewPushNewBranchesRef(value bool) *PushNewBranches

func ParsePushNewBranches

func ParsePushNewBranches(value, source string) (PushNewBranches, error)

func ParsePushNewBranchesRef

func ParsePushNewBranchesRef(value, source string) (*PushNewBranches, error)

func (PushNewBranches) Bool

func (self PushNewBranches) Bool() bool

func (PushNewBranches) String

func (self PushNewBranches) String() string

type ShipDeleteTrackingBranch

type ShipDeleteTrackingBranch bool

ShipDeleteTrackingBranch contains the configuration setting about whether to delete the tracking branch when shipping.

func NewShipDeleteTrackingBranch

func NewShipDeleteTrackingBranch(value bool) ShipDeleteTrackingBranch

func NewShipDeleteTrackingBranchRef

func NewShipDeleteTrackingBranchRef(value bool) *ShipDeleteTrackingBranch

func ParseShipDeleteTrackingBranch

func ParseShipDeleteTrackingBranch(value, source string) (ShipDeleteTrackingBranch, error)

func ParseShipDeleteTrackingBranchRef

func ParseShipDeleteTrackingBranchRef(value, source string) (*ShipDeleteTrackingBranch, error)

func (ShipDeleteTrackingBranch) Bool

func (self ShipDeleteTrackingBranch) Bool() bool

func (ShipDeleteTrackingBranch) String

func (self ShipDeleteTrackingBranch) String() string

type SyncBeforeShip

type SyncBeforeShip bool

func NewSyncBeforeShip

func NewSyncBeforeShip(value bool) SyncBeforeShip

func NewSyncBeforeShipRef

func NewSyncBeforeShipRef(value bool) *SyncBeforeShip

func ParseSyncBeforeShip

func ParseSyncBeforeShip(value, source string) (SyncBeforeShip, error)

func ParseSyncBeforeShipRef

func ParseSyncBeforeShipRef(value, source string) (*SyncBeforeShip, error)

func (SyncBeforeShip) Bool

func (self SyncBeforeShip) Bool() bool

func (SyncBeforeShip) String

func (self SyncBeforeShip) String() string

type SyncFeatureStrategy

type SyncFeatureStrategy string

SyncFeatureStrategy defines legal values for the "sync-feature-strategy" configuration setting.

func NewSyncFeatureStrategy

func NewSyncFeatureStrategy(text string) (SyncFeatureStrategy, error)

func NewSyncFeatureStrategyRef

func NewSyncFeatureStrategyRef(text string) (*SyncFeatureStrategy, error)

func (SyncFeatureStrategy) String

func (self SyncFeatureStrategy) String() string

func (SyncFeatureStrategy) StringRef

func (self SyncFeatureStrategy) StringRef() *string

type SyncPerennialStrategy

type SyncPerennialStrategy string

SyncPerennialStrategy defines legal values for the "sync-perennial-strategy" configuration setting.

func NewSyncPerennialStrategy

func NewSyncPerennialStrategy(text string) (SyncPerennialStrategy, error)

func NewSyncPerennialStrategyRef

func NewSyncPerennialStrategyRef(text string) (*SyncPerennialStrategy, error)

func (SyncPerennialStrategy) String

func (self SyncPerennialStrategy) String() string

func (SyncPerennialStrategy) StringRef

func (self SyncPerennialStrategy) StringRef() *string

type SyncUpstream

type SyncUpstream bool

SyncUpstream contains the configuration setting whether to sync with the upstream remote.

func NewSyncUpstreamRef

func NewSyncUpstreamRef(value bool) *SyncUpstream

func ParseSyncUpstream

func ParseSyncUpstream(value, source string) (SyncUpstream, error)

func ParseSyncUpstreamRef

func ParseSyncUpstreamRef(value, source string) (*SyncUpstream, error)

func (SyncUpstream) Bool

func (self SyncUpstream) Bool() bool

func (SyncUpstream) String

func (self SyncUpstream) String() string

Jump to

Keyboard shortcuts

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