update

package
v1.31.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package update provides repository update orchestration and output formatting.

Index

Constants

View Source
const (
	// IconUpdated is the icon for successfully updated repositories.
	IconUpdated = "✓"
	// IconDiverged is the icon for diverged branches.
	IconDiverged = "⚠"
	// IconDirty is the icon for repositories with uncommitted changes.
	IconDirty = "⚠"
	// IconDetached is the icon for detached HEAD state.
	IconDetached = "⚠"
	// IconWarning is the icon for warning conditions.
	IconWarning = "⚠"
	// IconFailed is the icon for failed operations.
	IconFailed = "✗"
	// IconSkipped is the icon for skipped repositories.
	IconSkipped = "○"
)

Variables

This section is empty.

Functions

func DetermineRequiredRepositories

func DetermineRequiredRepositories(caproniCfg *v2.CaproniConfig) *orderedmap.OrderedMap[string, bool]

DetermineRequiredRepositories returns the set of repository names that are required based on edit_mode deployers and reloaders in the configuration. The returned OrderedMap preserves the order in which repositories appear in the config.

func FormatSuggestions

func FormatSuggestions(results []*UpdateResult) string

FormatSuggestions generates actionable suggestions for repositories needing attention.

func FormatSummary

func FormatSummary(results []*UpdateResult) string

FormatSummary generates summary counts with pterm styling.

func FormatTable

func FormatTable(results []*UpdateResult, quiet bool) (string, error)

FormatTable formats results as a styled table using pterm.

Types

type RepoFilterFunc

type RepoFilterFunc func(repoName string) bool

RepoFilterFunc is a predicate function that determines whether a repository should be processed. It receives the repository name and returns true if the repo should be processed, false to skip.

type UpdateOptions

type UpdateOptions struct {
	Strategy UpdateStrategy
	Stash    bool
	Filter   RepoFilterFunc
	Quiet    bool
}

UpdateOptions contains options for the update operation.

type UpdateResult

type UpdateResult struct {
	RepoName       string
	Status         UpdateStatus
	Branch         string
	DefaultBranch  string
	CommitsBehind  int
	CommitsAhead   int
	TrackingBranch string
	Notes          string
	Error          error
}

UpdateResult represents the result of updating a single repository.

type UpdateStatus

type UpdateStatus int

UpdateStatus represents the status of a repository update operation.

const (
	// StatusUpdated indicates the repository was successfully updated.
	StatusUpdated UpdateStatus = iota

	// StatusDiverged indicates the local branch has diverged from remote.
	StatusDiverged

	// StatusDirty indicates uncommitted changes prevent update.
	StatusDirty

	// StatusDetached indicates HEAD is detached (not on any branch).
	StatusDetached

	// StatusWarning indicates a warning condition (no tracking branch, remote mismatch, etc.).
	StatusWarning

	// StatusFailed indicates the update operation failed.
	StatusFailed

	// StatusSkipped indicates the repository was skipped (not cloned, filtered out, etc.).
	StatusSkipped
)

func (UpdateStatus) String

func (s UpdateStatus) String() string

String returns a human-readable string representation of the status.

type UpdateStrategy

type UpdateStrategy int

UpdateStrategy defines the strategy for repository updates.

const (
	// StrategyFullUpdate performs complete operations: clone missing edit_mode repos and update existing repos.
	// This is the default strategy for 'caproni update'.
	StrategyFullUpdate UpdateStrategy = iota

	// StrategyMinimalRequired performs minimal actions: clone missing repos only, skip all updates.
	// This is used by 'caproni up' to ensure repos exist before starting the cluster.
	StrategyMinimalRequired

	// StrategyVerifyOnly checks repository states without making any changes (dry-run mode).
	StrategyVerifyOnly
)

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater orchestrates repository updates.

func NewUpdater

func NewUpdater(backend git.Backend, opts UpdateOptions) *Updater

NewUpdater creates a new Updater with the given backend and options.

func (*Updater) UpdateRepositories

func (u *Updater) UpdateRepositories(ctx context.Context, exec executor.CommandRunner, caproniCfg *v2.CaproniConfig) ([]*UpdateResult, bool)

UpdateRepositories updates multiple repositories based on configuration. Returns results for all repositories and a success flag. The success flag is false if any repository has StatusFailed.

Jump to

Keyboard shortcuts

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