vcs

package
v0.34.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadFailedError

type DownloadFailedError struct {
	Repository string
	Inner      error
}

DownloadFailedError represents a failure to download a repository.

func (DownloadFailedError) Error

func (err DownloadFailedError) Error() string

Error returns the error string, denoting the failed repository.

func (DownloadFailedError) Unwrap

func (err DownloadFailedError) Unwrap() error

Unwrap returns the inner error. It returns nil if there is no inner error.

type GitRepo

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

GitRepo manages a Git repository for the purposes of retrieving a file from it.

func NewGitRepo

func NewGitRepo(ctx context.Context, storagePath string, opts GitRepoOptions) (*GitRepo, error)

NewGitRepo creates a new instance of a GitRepo, where the Git repository is managed at storagePath.

If storagePath is empty on disk, NewGitRepo initializes GitRepo by cloning the repository. Otherwise, NewGitRepo will do a fetch.

After GitRepo is initialized, it checks out to the Revision specified in GitRepoOptions.

func (*GitRepo) CurrentRevision

func (repo *GitRepo) CurrentRevision() (string, error)

CurrentRevision returns the current revision of the repository (by SHA).

func (*GitRepo) ReadFile

func (repo *GitRepo) ReadFile(path string) ([]byte, error)

ReadFile returns a file from the repository specified by path.

func (*GitRepo) Update

func (repo *GitRepo) Update(ctx context.Context) error

Update updates the repository by fetching new content and re-checking out to latest version of Revision.

type GitRepoOptions

type GitRepoOptions struct {
	Repository string
	Revision   string
}

type InvalidRevisionError

type InvalidRevisionError struct {
	Revision string
}

InvalidRevisionError represents an invalid revision.

func (InvalidRevisionError) Error

func (err InvalidRevisionError) Error() string

Error returns the error string, denoting the invalid revision.

type UpdateFailedError

type UpdateFailedError struct {
	Repository string
	Inner      error
}

UpdateFailedError represents a failure to update a repository.

func (UpdateFailedError) Error

func (err UpdateFailedError) Error() string

Error returns the error string, denoting the failed repository.

func (UpdateFailedError) Unwrap

func (err UpdateFailedError) Unwrap() error

Unwrap returns the inner error. It returns nil if there is no inner error.

Jump to

Keyboard shortcuts

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