context

package
v0.12.0-pre.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlank

func NewBlank() *blankContext

NewBlank initializes a blank Context suitable for testing

Types

type Context

type Context interface {
	Config() (config.Config, error)
}

Context represents the interface for querying information about the current environment

func New

func New() Context

New initializes a Context that reads from the filesystem

type Remote

type Remote struct {
	*git.Remote
	Repo ghrepo.Interface
}

Remote represents a git remote mapped to a GitHub repository

func (Remote) RepoHost added in v0.11.0

func (r Remote) RepoHost() string

RepoHost is the GitHub hostname that the remote points to

func (Remote) RepoName

func (r Remote) RepoName() string

RepoName is the name of the GitHub repository

func (Remote) RepoOwner

func (r Remote) RepoOwner() string

RepoOwner is the name of the GitHub account that owns the repo

type Remotes

type Remotes []*Remote

Remotes represents a set of git remotes

func TranslateRemotes added in v0.12.0

func TranslateRemotes(gitRemotes git.RemoteSet, urlTranslate func(*url.URL) *url.URL) (remotes Remotes)

TODO: accept an interface instead of git.RemoteSet

func (Remotes) FindByName

func (r Remotes) FindByName(names ...string) (*Remote, error)

FindByName returns the first Remote whose name matches the list

func (Remotes) FindByRepo

func (r Remotes) FindByRepo(owner, name string) (*Remote, error)

FindByRepo returns the first Remote that points to a specific GitHub repository

func (Remotes) Len

func (r Remotes) Len() int

https://golang.org/pkg/sort/#Interface

func (Remotes) Less

func (r Remotes) Less(i, j int) bool

func (Remotes) Swap

func (r Remotes) Swap(i, j int)

type ResolvedRemotes added in v0.5.5

type ResolvedRemotes struct {
	BaseOverride ghrepo.Interface
	Remotes      Remotes
	Network      api.RepoNetworkResult
	// contains filtered or unexported fields
}

func ResolveRemotesToRepos added in v0.5.5

func ResolveRemotesToRepos(remotes Remotes, client *api.Client, base string) (ResolvedRemotes, error)

ResolveRemotesToRepos takes in a list of git remotes and fetches more information about the repositories they map to. Only the git remotes belonging to the same hostname are ever looked up; all others are ignored.

func (ResolvedRemotes) BaseRepo added in v0.5.5

func (r ResolvedRemotes) BaseRepo() (*api.Repository, error)

BaseRepo is the first found repository in the "upstream", "github", "origin" git remote order, resolved to the parent repo if the git remote points to a fork

func (ResolvedRemotes) HeadRepo added in v0.5.5

func (r ResolvedRemotes) HeadRepo() (*api.Repository, error)

HeadRepo is a fork of base repo (if any), or the first found repository that has push access

func (ResolvedRemotes) RemoteForRepo added in v0.5.5

func (r ResolvedRemotes) RemoteForRepo(repo ghrepo.Interface) (*Remote, error)

RemoteForRepo finds the git remote that points to a repository

Jump to

Keyboard shortcuts

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