gitutils

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: BSD-3-Clause Imports: 14 Imported by: 9

Documentation

Index

Constants

View Source
const (
	GIT_SERVICE_CONFIG_FILE = "GitServiceConfig.yaml"
)

Variables

View Source
var (
	CHECKMATE_USER = "checkmate"
)

Functions

func Clone

func Clone(ctx context.Context, repository string, options *GitCloneOptions) (string, error)

Clone a repository,returning the location on disk where the clone is placed

func GetCheckoutLocation

func GetCheckoutLocation(repository, baseDirectory string) (string, error)

returns the checkout location on disk for the specified git repository, given a base directory The pattern for base directory is baseDirectory := path.Join(pm.GetCodeBaseDir(), projectID)

Types

type Author

type Author struct {
	Name, Email string
}

type Commit

type Commit struct {
	Author
	Hash, Branch string
	//Commit time
	Time time.Time
	//is the default branch to scan?
	IsHead bool
}

type GitAuth

type GitAuth struct {
	User, Credential string
}

Authentication parameters

type GitCloneOptions

type GitCloneOptions struct {
	// Directory to clone into
	BaseDir string
	// Authentication detail
	Auth *GitAuth
	// Depth limit cloning/fetching to the specified number of commits from the tip of
	// each remote branch history.
	Depth int
	// If set, checkout the specified commit
	CommitHash string
}

type GitConfigManager

type GitConfigManager interface {
	GetConfig() (*GitServiceConfig, error)
	SaveConfig(*GitServiceConfig) error
}

func NewGitConfigManager

func NewGitConfigManager(baseDirectory string) GitConfigManager

Git Service Config Manager

type GitService

type GitService struct {
	InstanceURL     string
	GraphQLEndPoint string
	APIEndPoint     string
	API_Key         string
	ID              string         //some unique ID for this service instance
	Name            string         //user-friendly name
	AccountName     string         //used to track Github user/org name
	AccountType     string         //(GitHub) User or Organization
	Type            GitServiceType `json:"_"`
}

func (GitService) MakeAuth

func (svc GitService) MakeAuth() *GitAuth

type GitServiceConfig

type GitServiceConfig struct {
	GitServices map[GitServiceType]map[string]*GitService
}

func (*GitServiceConfig) AddService

func (gsc *GitServiceConfig) AddService(service *GitService) error

func (GitServiceConfig) FindService

func (gsc GitServiceConfig) FindService(serviceID string) (*GitService, error)

func (GitServiceConfig) GetService

func (gsc GitServiceConfig) GetService(serviceType GitServiceType, serviceID string) (*GitService, error)

func (GitServiceConfig) IsServiceConfigured

func (gsc GitServiceConfig) IsServiceConfigured(service GitServiceType) bool

type GitServiceType

type GitServiceType int
const (
	GitHub GitServiceType = iota
	GitLab
)

type RepositoryCloneSpec

type RepositoryCloneSpec struct {
	Repository string
	ServiceID  string // the Github or Gitlab service ID
	Options    GitCloneOptions
}

Jump to

Keyboard shortcuts

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