gitupdate

package
v0.0.0-...-d677dd8 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: AGPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	Path          string
	Host          string
	Org           string
	Name          string
	DefaultBranch string
	CurrentBranch string
}

Repository represents a discovered git repository.

func DiscoverRepositories

func DiscoverRepositories(ctx context.Context, root string) ([]Repository, error)

DiscoverRepositories walks the directory tree and finds all git repositories. It expects a GOPATH-style structure: root/{host}/{org}/{repo}/.git Worktrees are skipped (detected by .git being a file instead of a directory).

func (Repository) FullName

func (r Repository) FullName() string

FullName returns the host/org/name identifier for the repository.

type StatusCallback

type StatusCallback func(action string)

StatusCallback is called to report progress during repository update.

type Summary

type Summary struct {
	Updated         []UpdateResult
	AlreadyUpToDate []UpdateResult
	Skipped         []UpdateResult
	Errors          []UpdateResult
	TotalRepos      int
	Duration        time.Duration
}

Summary aggregates all update results.

func BuildSummary

func BuildSummary(results []UpdateResult) Summary

BuildSummary creates a summary from a slice of results.

type UpdateResult

type UpdateResult struct {
	Repo      Repository
	Status    UpdateStatus
	Message   string
	OldCommit string
	NewCommit string
	Error     error
}

UpdateResult represents the outcome of updating a single repository.

func UpdateRepository

func UpdateRepository(ctx context.Context, repo Repository, dryRun bool, callback StatusCallback) UpdateResult

UpdateRepository performs the fetch and update for a single repository. The callback is called with status updates during the operation.

type UpdateStatus

type UpdateStatus int

UpdateStatus represents the possible outcomes of updating a repository.

const (
	StatusUpdated UpdateStatus = iota
	StatusAlreadyUpToDate
	StatusSkippedDirty
	StatusSkippedNotDefaultBranch
	StatusSkippedNoRemote
	StatusSkippedWorktree
	StatusError
)

func (UpdateStatus) String

func (s UpdateStatus) String() string

type WorkerPool

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

WorkerPool manages parallel repository updates.

func NewWorkerPool

func NewWorkerPool(ctx context.Context, workers int, dryRun bool) *WorkerPool

NewWorkerPool creates a new worker pool.

func (*WorkerPool) Close

func (p *WorkerPool) Close()

Close signals no more jobs and waits for completion.

func (*WorkerPool) Results

func (p *WorkerPool) Results() <-chan UpdateResult

Results returns the results channel for reading.

func (*WorkerPool) Start

func (p *WorkerPool) Start()

Start launches worker goroutines.

func (*WorkerPool) StatusUpdates

func (p *WorkerPool) StatusUpdates() <-chan WorkerStatus

StatusUpdates returns the status update channel for live display.

func (*WorkerPool) Submit

func (p *WorkerPool) Submit(repo Repository)

Submit adds a repository to the job queue.

type WorkerStatus

type WorkerStatus struct {
	WorkerID int
	Repo     string
	Action   string
	Idle     bool
}

WorkerStatus represents the current state of a worker for live display.

Jump to

Keyboard shortcuts

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