vcsdriver

package
v0.0.0-...-57fe098 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package vcsdriver defines the API used to implement VCS (version control system) drivers.

A VCS driver provides the VCS-specific implementation that a source driver uses to manipulate and inspect repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// DescribeVCSConfig returns a human-readable description of the
	// configuration.
	DescribeVCSConfig() string
}

Config is a driver-specific VCS configuration.

The underlying implementation must not be used by more than one VCS driver.

type ConfigContext

type ConfigContext interface {
	// EvalContext returns the HCL evaluation context to be used when to
	// decoding HCL content.
	EvalContext() *hcl.EvalContext

	// NormalizePath resolves a (potentially relative) filesystem path to an
	// absolute path.
	//
	// If *p begins with a tilde (~), it is resolved relative to the user's home
	// directory.
	//
	// If *p is a relative path, it is resolved to an absolute path relative to
	// the directory containing the configuration file that is currently being
	// parsed.
	//
	// It does nothing if p is nil or *p is empty.
	NormalizePath(p *string) error
}

ConfigContext provides operations used when loading VCS configuration.

type ConfigLoader

type ConfigLoader interface {
	// Defaults returns the default configuration for this driver.
	Defaults(ctx ConfigContext) (Config, error)

	// UnmarshalAndMerge unmarshals the contents of a "vcs" block and returns
	// the result of merging it with an existing configuration.
	//
	// c is the existing configuration, b is the body of the "vcs" block. c must
	// not be modified.
	UnmarshalAndMerge(ctx ConfigContext, c Config, b hcl.Body) (Config, error)
}

ConfigLoader is an interface for loading driver-specific VCS configuration.

type Registration

type Registration struct {
	// Name is the (preferred) name of the driver, as referenced within
	// configuration files.
	Name string

	// Description is a short human-readable description of the driver.
	Description string

	// ConfigLoader loads configuration for this driver.
	ConfigLoader ConfigLoader
}

Registration encapsulates the information required to register a source driver implementation with Grit.

Jump to

Keyboard shortcuts

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