repo

package
v0.0.0-...-ed8d817 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CurrentVersion of the configuration file.
	CurrentVersion = "1.0"
	// ConfigFileName is the configuration file name.
	ConfigFileName = "pathdep.yaml"
)
View Source
const (
	BranchPrefix = "refs/heads/"
	TagPrefix    = "refs/tags/"
)

Prefixes for the refs.

Variables

This section is empty.

Functions

func GitRemote

func GitRemote(pkg string) string

GitRemote returns the git URL for the package.

Types

type Config

type Config struct {
	Dir          string `yaml:"-"`
	Version      string
	Dependencies Dependencies
}

Config holds the configuration.

func NewConfigFromDir

func NewConfigFromDir(dir string) (*Config, error)

NewConfigFromDir creates a new configuration from the configuration file in the directory.

func (*Config) Save

func (cfg *Config) Save() error

Save the configuration file.

type Dependencies

type Dependencies []*Dependency

Dependencies provides a sortable slice of dependencies.

func (Dependencies) Len

func (d Dependencies) Len() int

func (Dependencies) Less

func (d Dependencies) Less(i, j int) bool

func (Dependencies) Swap

func (d Dependencies) Swap(i, j int)

type Dependency

type Dependency struct {
	Import string
	Commit string `json:",omitempty" yaml:",omitempty"`
	Tag    string `json:",omitempty" yaml:",omitempty"`
	Branch string `json:",omitempty" yaml:",omitempty"`
}

Dependency holds dependency information.

type Repo

type Repo struct {
	ImportPath string
}

Repo holds information for the git repo.

func NewFromImportPath

func NewFromImportPath(importPath string, force bool) (*Repo, error)

NewFromImportPath creates a new repo from the import path.

func (*Repo) Checkout

func (repo *Repo) Checkout(commit string) error

Checkout runs the git checkout command.

func (*Repo) Clone

func (repo *Repo) Clone(branchOrTag string) error

Clone runs the git clone command.

func (*Repo) Exec

func (repo *Repo) Exec(cmd string, arg ...string) (string, error)

Exec runs a git command against the repo.

func (*Repo) Fetch

func (repo *Repo) Fetch() error

Fetch runs the git fetch command.

func (*Repo) Pull

func (repo *Repo) Pull() error

Pull runs the git pull command.

func (*Repo) Remote

func (repo *Repo) Remote() string

Remote returns the git remote URL for the repo.

func (*Repo) Root

func (repo *Repo) Root() string

Root returns the root of the repo.

func (*Repo) State

func (repo *Repo) State() *State

State returns the state of the repo.

type State

type State struct {
	Import   string
	Branches []string
	Tags     []string
	Commit   string
	Dirty    bool
	Exists   bool
}

State holds the state of a repo.

func (*State) HasBranch

func (state *State) HasBranch(branch string) bool

HasBranch returns true if the repo has the specified branch.

func (*State) HasTag

func (state *State) HasTag(tag string) bool

HasTag returns true if the repo has the specified tag.

type States

type States []*State

States provides a sortable slice of states.

func (States) Len

func (s States) Len() int

func (States) Less

func (s States) Less(i, j int) bool

func (States) Swap

func (s States) Swap(i, j int)

Jump to

Keyboard shortcuts

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