repositorystore

package
v0.3.0-rc4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = fmt.Errorf("not supported")

ErrNotSupported indicates that a method is not supported.

View Source
var GitBinary = "git"

Functions

func GetDefaultBranch

func GetDefaultBranch(repository *domain.GitRepository) (string, error)

GetDefaultBranch returns the name of the default branch in origin. Returns an error if either Git command failed or if no default branch could be detected.

func HasCommitsBetween

func HasCommitsBetween(repository *domain.GitRepository, rootBranch, headBranch string) (bool, error)

HasCommitsBetween returns true if there are commits in the given revision range. If headBranch is empty, "HEAD" is used. Returns ErrInvalidArgument if rootBranch is empty. Returns errors in all other Git failures.

Types

type ManagedGitRepo

type ManagedGitRepo struct {
	Name string
}

ManagedGitRepo is the representation of the managed git repos in the config file.

type RepositoryStore

type RepositoryStore struct {
	StoreConfig
	// contains filtered or unexported fields
}

func NewRepositoryStore

func NewRepositoryStore(instrumentation *RepositoryStoreInstrumentation) *RepositoryStore

func (*RepositoryStore) Add

func (s *RepositoryStore) Add(repository *domain.GitRepository) error

func (*RepositoryStore) Checkout

func (s *RepositoryStore) Checkout(repository *domain.GitRepository) error

func (*RepositoryStore) Clone

func (s *RepositoryStore) Clone(repository *domain.GitRepository) error

func (*RepositoryStore) Commit

func (s *RepositoryStore) Commit(repository *domain.GitRepository, options domain.CommitOptions) error

func (*RepositoryStore) Diff

func (s *RepositoryStore) Diff(repository *domain.GitRepository, options domain.DiffOptions) (string, error)

func (*RepositoryStore) Fetch

func (s *RepositoryStore) Fetch(repository *domain.GitRepository) error

func (*RepositoryStore) FetchGitRepositories

func (s *RepositoryStore) FetchGitRepositories() ([]*domain.GitRepository, error)

func (*RepositoryStore) IsDirty

func (s *RepositoryStore) IsDirty(repository *domain.GitRepository) bool

func (*RepositoryStore) Pull

func (s *RepositoryStore) Pull(repository *domain.GitRepository) error

func (*RepositoryStore) Push

func (s *RepositoryStore) Push(repository *domain.GitRepository, options domain.PushOptions) error

func (*RepositoryStore) Reset

func (s *RepositoryStore) Reset(repository *domain.GitRepository) error

type RepositoryStoreInstrumentation

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

func NewRepositoryStoreInstrumentation

func NewRepositoryStoreInstrumentation(factory logging.LoggerFactory) *RepositoryStoreInstrumentation

type StoreConfig

type StoreConfig struct {
	ParentDir        string
	DefaultNamespace string
	CommitBranch     string
	BaseURL          string

	IncludeFilter string
	ExcludeFilter string
	// ManagedReposFileName is the base file name where managed git repositories config is searched.
	ManagedReposFileName string
}

type TestRepositoryStore

type TestRepositoryStore struct {
	StoreConfig
	// TestOutputRootDir is the root dir where the test artifacts are rendered per repository.
	// This is used for comparing the diff.
	TestOutputRootDir string
	// contains filtered or unexported fields
}

TestRepositoryStore implements domain.GitRepositoryStore but doesn't actually use or interact with Git repositories. Instead, the purpose is to "fake" Git repositories so that they can be used for testing templates.

func NewTestRepositoryStore

func NewTestRepositoryStore(instrumentation *RepositoryStoreInstrumentation) *TestRepositoryStore

NewTestRepositoryStore creates a new TestRepositoryStore.

func (*TestRepositoryStore) Add

Add returns ErrNotSupported.

func (*TestRepositoryStore) Checkout

Checkout returns ErrNotSupported.

func (*TestRepositoryStore) Clone

Clone returns ErrNotSupported.

func (*TestRepositoryStore) Commit

Commit returns ErrNotSupported.

func (*TestRepositoryStore) CopySyncFile

func (s *TestRepositoryStore) CopySyncFile(repository *domain.GitRepository) error

CopySyncFile copies the sync file from StoreConfig.ParentDir to TestRepositoryStore.TestOutputRootDir. It returns nil if the sync file doesn't exist.

func (*TestRepositoryStore) Diff

Diff implements domain.GitRepositoryStore. Since this implementation is meant for testing local fake repositories, the diff will be computed against the files stored in TestRepositoryStore.TestOutputRootDir. The files in the repository's RootDir are the expected files, where "---" is the expected file content, and "+++" the actual content.

func (*TestRepositoryStore) Fetch

Fetch returns ErrNotSupported.

func (*TestRepositoryStore) FetchGitRepositories

func (s *TestRepositoryStore) FetchGitRepositories() ([]*domain.GitRepository, error)

FetchGitRepositories implements domain.GitRepositoryStore.

func (*TestRepositoryStore) Pull

Pull returns ErrNotSupported.

func (*TestRepositoryStore) Push

Push returns ErrNotSupported.

func (*TestRepositoryStore) Reset

Reset returns ErrNotSupported.

Jump to

Keyboard shortcuts

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