supported_branches

package
v0.0.0-...-bc12874 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Path to the encoded SupportedBranchesConfig file.
	SUPPORTED_BRANCHES_FILE = "supported-branches.json"
	// The ref where the SupportedBranchesConfig file is stored.
	SUPPORTED_BRANCHES_REF = "infra/config"
)

Variables

This section is empty.

Functions

func EncodeConfig

func EncodeConfig(w io.Writer, c *SupportedBranchesConfig) error

EncodeConfig writes a SupportedBranchesConfig.

func WriteConfig

func WriteConfig(f string, c *SupportedBranchesConfig) error

WriteConfig writes a SupportedBranchesConfig to the given file.

Types

type SupportedBranch

type SupportedBranch struct {
	// Ref is the full name of the ref, including the "refs/heads/" prefix.
	Ref string `json:"ref"`
	// Owner is the email address of the owner of this branch. It can be a
	// comma-separated list.
	Owner string `json:"owner"`
}

SupportedBranch represents a single supported branch in a given repo.

type SupportedBranchList

type SupportedBranchList []*SupportedBranch

SupportedBranchList is a helper used for sorting in a special order: main branch first, then all other branches in alphanumeric order, with the exception of Branches which differ only by an integer suffix, which are compared according to the integer, ie. refs/heads/chrome/m99 sorts before refs/heads/chrome/m100.

func (SupportedBranchList) Len

func (l SupportedBranchList) Len() int

func (SupportedBranchList) Less

func (l SupportedBranchList) Less(a, b int) bool

func (SupportedBranchList) Swap

func (l SupportedBranchList) Swap(a, b int)

type SupportedBranchesConfig

type SupportedBranchesConfig struct {
	// Branches is a list of supported branches.
	Branches []*SupportedBranch `json:"branches"`
}

SupportedBranchesConfig lists which branches the infrastructure team supports for a given repo.

func DecodeConfig

func DecodeConfig(r io.Reader) (*SupportedBranchesConfig, error)

DecodeConfig parses a SupportedBranchesConfig.

func ReadConfig

func ReadConfig(f string) (*SupportedBranchesConfig, error)

ReadConfig reads a SupportedBranchesConfig from the given file.

func ReadConfigFromRepo

func ReadConfigFromRepo(repo *gitiles.Repo) (*SupportedBranchesConfig, error)

ReadConfigFromRepo reads a SupportedBranchesConfig from the given repo.

func (*SupportedBranchesConfig) Sort

func (c *SupportedBranchesConfig) Sort()

Sort sorts the branches in a special order: main branch first, then all other branches in alphanumeric order, with the exception of branches which differ only by an integer suffix, which are compared according to the integer, ie. refs/heads/chrome/m99 sorts before refs/heads/chrome/m100.

Jump to

Keyboard shortcuts

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