Documentation
¶
Overview ¶
Package branches provides logic for finding and managing branches across multiple git repositories.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAutomationBranch ¶ added in v0.3.0
IsAutomationBranch returns true if the branch name matches a known automation pattern.
Types ¶
type MergedBranch ¶
type MergedBranch struct {
RepoPath string
RepoName string
Branch string
LastCommit time.Time
HasRemote bool
}
MergedBranch represents a branch that has been merged into the default branch.
func FindMerged ¶
func FindMerged(repos []string, workers int, onProgress func(completed, total int)) ([]MergedBranch, error)
FindMerged scans the given repositories and returns branches that have been merged into each repo's default branch. The current branch and the default branch itself are excluded from results. Work is parallelized across the given number of workers.
func (MergedBranch) Label ¶
func (m MergedBranch) Label() string
Label returns a display string for the merged branch in the form "repo: branch". Branches with a remote counterpart are annotated with "(+ remote)".
type StaleBranch ¶ added in v0.2.2
type StaleBranch struct {
RepoPath string
RepoName string
Branch string
LastCommit time.Time
LastCommitMessage string
CommitsAhead int
CommitsBehind int
HasRemote bool
// IsLocalOnly is true when the branch has no remote tracking branch.
// These are candidates for cleanup but require extra caution since
// commits may not exist anywhere else.
IsLocalOnly bool
// IsAutomation is true for branches matching known automation patterns
// (e.g. dependabot/*, renovate/*, release-please--*).
IsAutomation bool
// IsOwnBranch is true when the user is the sole author of all commits
// on this branch since it diverged from the default branch.
IsOwnBranch bool
}
StaleBranch represents a branch that has not been committed to within the configured staleness threshold and has not been merged.
func FindStale ¶ added in v0.2.2
func FindStale(repos []string, threshold time.Duration, workers int, onProgress func(completed, total int)) ([]StaleBranch, error)
FindStale scans the given repositories and returns branches whose last commit is older than the given threshold. Merged branches, the default branch, and the currently checked out branch are excluded. Work is parallelized across the given number of workers.
func (StaleBranch) Label ¶ added in v0.2.2
func (s StaleBranch) Label() string
Label returns a display string for the stale branch in the form "repo: branch".