vcs

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneGitRepo

func CloneGitRepo(ctx context.Context, link, dir string) (*git.Repository, error)

CloneGitRepo clones a git repository to a specific directory.

func GetGitRepoVersions

func GetGitRepoVersions(r *git.Repository) ([]*version.Version, error)

GetGitRepoVersions returns all versions of a git repository in descending order.

func GetGitSource

func GetGitSource(link string) (string, error)

GetGitSource get git source for template. When source's protocol is http or https, the prefix git:: will be added for template to use.

func GetRepoRef

func GetRepoRef(r *git.Repository, name string) (*plumbing.Reference, error)

GetRepoRef returns a reference from a git repository.

func HardResetGitRepo

func HardResetGitRepo(r *git.Repository, ref string) error

HardResetGitRepo hard resets a git repository to a specific hash.

func NewClient

func NewClient(conn *model.Connector) (*scm.Client, error)

func NewClientFromURL

func NewClientFromURL(driver, url, token string) (*scm.Client, error)

Types

type Repository

type Repository struct {
	Namespace   string `json:"namespace"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Link        string `json:"link"`
	Reference   string `json:"reference"`
}

func ParseURLToRepo

func ParseURLToRepo(rawURL string) (*Repository, error)

ParseURLToGit parses a raw URL to a git repository. Since the return repository only contains the namespace and name, It only used for create template from catalog.

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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