context

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package context provides repository resolution from git remotes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Remote

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

Remote represents a git remote mapped to a Bitbucket repository

func (Remote) RepoHost

func (r Remote) RepoHost() string

RepoHost is the Bitbucket hostname that the remote points to

func (Remote) RepoSlug

func (r Remote) RepoSlug() string

RepoSlug is the slug of the Bitbucket repository

func (Remote) RepoWorkspace

func (r Remote) RepoWorkspace() string

RepoWorkspace is the name of the Bitbucket workspace that owns the repo

type Remotes

type Remotes []*Remote

Remotes represents a set of git remotes

func TranslateRemotes

func TranslateRemotes(gitRemotes git.RemoteSet, translator Translator) (remotes Remotes)

func (Remotes) FilterByHosts

func (r Remotes) FilterByHosts(hosts []string) Remotes

Filter remotes by given hostnames, maintains original order

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(workspace, repoSlug string) (*Remote, error)

FindByRepo returns the first Remote that points to a specific Bitbucket 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) ResolvedRemote

func (r Remotes) ResolvedRemote() (*Remote, error)

func (Remotes) Swap

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

type ResolvedRemotes

type ResolvedRemotes struct {
	// contains filtered or unexported fields
}

func ResolveRemotesToRepos

func ResolveRemotesToRepos(remotes Remotes, base string) (*ResolvedRemotes, error)

func (*ResolvedRemotes) BaseRepo

func (*ResolvedRemotes) RemoteForRepo

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

RemoteForRepo finds the git remote that points to a repository

func (*ResolvedRemotes) Remotes

func (r *ResolvedRemotes) Remotes() Remotes

Remotes returns the list of remotes

type Translator

type Translator interface {
	Translate(*url.URL) *url.URL
}

Jump to

Keyboard shortcuts

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