gitfetcher

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package gitfetcher creates local mirrors from remote git repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseConfig

func ParseConfig(fp string) (*configpb.Config, error)

ParseConfig returns a parsed configuration from a given path. The path may either point to a configuration file or a folder, in which case the default configuration file name will be used. The configuration's root will be automatically populated.

func Sync added in v0.3.0

func Sync(ctx context.Context, srcs []*Source, opts *configpb.Options) error

Sync syncs local copies in the root folder of each source. Missing local repositories will be created, others will be updated as needed.

Types

type Config

type Config = configpb.Config

Config is the generated configuration type, exported here for use in helper signatures.

type Source added in v0.1.0

type Source struct {
	FullName, FetchURL, Description, DefaultBranch, Path string
	LastUpdatedAt                                        time.Time
	// contains filtered or unexported fields
}

Source captures information about a repository to be mirrored.

func FindSources added in v0.1.0

func FindSources(ctx context.Context, cfg *configpb.Config) ([]*Source, error)

FindSources returns all sources for the provided configuration.

type SyncStatus added in v0.3.0

type SyncStatus int

SyncStatus captures possible states of the local repository vs its remote.

const (
	SyncStatusAbsent SyncStatus = iota
	SyncStatusStale
	SyncStatusFresh
)

func GetSyncStatus added in v0.3.0

func GetSyncStatus(src *Source, opts *configpb.Options) SyncStatus

GetSyncStatus returns the current SyncStatus of a source.

Jump to

Keyboard shortcuts

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