downloader

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotDownloadJob is returned when a not download job is found.
	ErrNotDownloadJob = errors.NewKind("not download job")

	// ErrRepoAlreadyExists is returned if there is an attempt to
	// retrieve an already downloaded git repository.
	ErrRepoAlreadyExists = errors.NewKind("%s already downloaded")
)
View Source
var (
	// ErrObjectTypeNotSupported returned by ResolveCommit when the
	// referenced object isn't a Commit nor a Tag.
	ErrObjectTypeNotSupported = errors.NewKind(
		"object type %q not supported")
)

Functions

func CloneRepository added in v0.0.3

func CloneRepository(
	ctx context.Context,
	fs billy.Filesystem,
	path, endpoint, id, token string,
) (*git.Repository, error)

CloneRepository clones a git repository from the given endpoint into the billy.Filesystem. A remote with the id is created for that.

func Download

func Download(ctx context.Context, job *library.Job) error

Download is a library.JobFn function to download a git repository and store it in a borges.Library.

func FetchChanges added in v0.0.3

func FetchChanges(
	ctx context.Context,
	r borges.Repository,
	remote string,
	token string,
) error

FetchChanges fetches changes for the given remote into the borges.Repository.

func PrepareRepository added in v0.0.3

func PrepareRepository(
	ctx context.Context,
	lib *siva.Library,
	locID borges.LocationID,
	repoID borges.RepositoryID,
	endpoint string,
	tmp billy.Filesystem,
	clonePath string,
) (borges.Repository, error)

PrepareRepository returns a borges.Repository ready to fetch changes. It creates a rooted repository copying the cloned repository in tmp to the siva file the library uses at the location with the given location ID, creating this location if not exists.

func RootCommit added in v0.0.3

func RootCommit(
	repo *git.Repository,
	remote string,
) (*object.Commit, error)

RootCommit traverse the commit history for the given remote following the first parent of each commit. The root commit found (commit with no parents) is returned.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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