Documentation
¶
Overview ¶
Package sync provides repository synchronization functionality
Index ¶
- type Options
- type ProgressCallback
- type ProgressStatus
- type Result
- type Syncer
- func (s *Syncer) SyncOrgRepos(ctx context.Context, org string) (*Result, error)
- func (s *Syncer) SyncRepo(ctx context.Context, owner, repo string) (*Result, error)
- func (s *Syncer) SyncRepoWithData(ctx context.Context, repo *gh.Repository) (*Result, error)
- func (s *Syncer) SyncUserRepos(ctx context.Context, username string) (*Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Target directory for synced repositories
Target string
// Include patterns for repository names (glob-style)
Include []string
// Exclude patterns for repository names (glob-style)
Exclude []string
// IncludePrivate includes private repositories
IncludePrivate bool
// DryRun simulates the sync without making changes
DryRun bool
// Verbose enables verbose output
Verbose bool
// OnProgress is called to report sync progress (optional)
OnProgress ProgressCallback
// Concurrency sets the number of parallel sync operations (default: 1)
Concurrency int
// SkipArchiveDetection skips the detectArchived() call which walks the entire
// target directory. This is useful when syncing single repos (e.g., TUI worker)
// where archive detection should be done once at the end, not per-repo.
SkipArchiveDetection bool
}
Options configures the sync operation
type ProgressCallback ¶
type ProgressCallback func(repoName string, status ProgressStatus, message string)
ProgressCallback is called to report sync progress repoName is the full repository name (owner/repo) status is the current status message provides additional context (e.g., error message)
type ProgressStatus ¶
type ProgressStatus int
ProgressStatus represents the status of a sync operation
const ( // ProgressPending indicates the repo is queued for sync ProgressPending ProgressStatus = iota // ProgressInProgress indicates the repo is currently being synced ProgressInProgress // ProgressCloned indicates the repo was cloned ProgressCloned // ProgressUpdated indicates the repo was updated ProgressUpdated // ProgressUpToDate indicates the repo is already up-to-date (fast check) ProgressUpToDate // ProgressSkipped indicates the repo was skipped ProgressSkipped // ProgressFailed indicates the repo sync failed ProgressFailed )
type Result ¶
type Result struct {
// Cloned repositories
Cloned []string
// Updated repositories (pulled)
Updated []string
// UpToDate repositories (already current, no pull needed)
UpToDate []string
// Skipped repositories (filtered out)
Skipped []string
// Failed repositories with errors
Failed map[string]error
// Archived repositories (exist locally but not on remote - preserved for backup)
Archived []string
}
Result represents the result of a sync operation
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer handles repository synchronization
func (*Syncer) SyncOrgRepos ¶
SyncOrgRepos syncs all repositories for an organization
func (*Syncer) SyncRepoWithData ¶
SyncRepoWithData syncs a single repository using pre-fetched data. This avoids redundant API calls when the repository data is already available.