Documentation
¶
Index ¶
- Constants
- Variables
- func BranchExists(branchPattern *regexp.Regexp, buildNumber string, branchType string, ...) (bool, error)
- func BranchType(release, factory, firmware, stabilize bool, custom string) (string, bool)
- func BranchesFromMilestone(chromeosCheckout string, minMilestone int) ([]string, error)
- func CheckSelfGroupMembership(authedClient *http.Client, gerritURL, expectedGroup string) (bool, error)
- func ExtractBuildNum(branch string) int
- func NewBranchName(vinfo mv.VersionInfo, custom, descriptor string, ...) string
- func ParseBuildspec(buildspec string) (*cv.VersionInfo, error)
- func WhichVersionShouldBump(vinfo mv.VersionInfo) (mv.VersionComponent, error)
- type CheckoutOptions
- type Client
- func (c *Client) AssertBranchesDoNotExist(branches []ProjectBranch, workerCount int) error
- func (c *Client) BumpForCreate(componentToBump mv.VersionComponent, sourceVersion *mv.VersionInfo, ...) error
- func (c *Client) CheckIfAlreadyBranched(vinfo mv.VersionInfo, manifestInternal repo.Project, force bool, ...) (bool, error)
- func (c *Client) CreateRemoteBranches(branches []ProjectBranch, dryRun, force bool, workerCount int) error
- func (c *Client) CreateRemoteBranchesAPI(authedClient *http.Client, branches []GerritProjectBranch, dryRun bool, ...) error
- func (c *Client) GerritProjectBranches(pbs []ProjectBranch) ([]GerritProjectBranch, error)
- func (c *Client) GetProjectCheckout(projectPath string, opts *CheckoutOptions) (string, error)
- func (c *Client) InitWorkingManifest(manifestURL, br string) error
- func (c *Client) LogErr(format string, a ...interface{})
- func (c *Client) LogOut(format string, a ...interface{})
- func (c *Client) ProjectBranches(br, original string) []ProjectBranch
- func (c *Client) ProjectFetchURL(projectPath string) (string, error)
- func (c *Client) RepairManifestRepositories(branches []ProjectBranch, dryRun, force bool) error
- func (c *Client) RepairManifestsOnDisk(m *ManifestRepo, branchesByPath map[string]string) error
- type GerritProjectBranch
- type ManifestRepo
- type ProjectBranch
Constants ¶
const VersionFileProjectPath = "src/third_party/chromiumos-overlay"
VersionFileProjectPath contains the path to the project containing the version file, relative to the checkout root.
Variables ¶
var ( // ManifestProjects contains information about the manifest projects. // Indexed by project path. ManifestProjects = map[string]bool{ "manifest": true, "manifest-internal": true, } // BranchPrefix is a regex matching a Chrome OS branch name as a prefix // to a string, starting with a dash (e.g. -release-R77-12371.B). BranchPrefix = regexp.MustCompile("^-.*[.]B") )
var ( // CommandRunnerImpl is the command runner impl currently being used by the // package. Exists for testing purposes. CommandRunnerImpl cmd.CommandRunner = cmd.RealCommandRunner{} )
Functions ¶
func BranchExists ¶
func BranchExists(branchPattern *regexp.Regexp, buildNumber string, branchType string, remoteBranches []string) (bool, error)
BranchExists checks that a branch matching the given pattern exists in a particular project.
func BranchType ¶
BranchType determines the type of branch to be created.
func BranchesFromMilestone ¶
BranchesFromMilestone returns a list of branch names in the sentinel manifest-internal repository associated with a milestone >= the specified minimum milestone.
func CheckSelfGroupMembership ¶
func CheckSelfGroupMembership(authedClient *http.Client, gerritURL, expectedGroup string) (bool, error)
CheckSelfGroupMembership checks if the authenticated user is in the given group on the given Gerrit host. It returns a bool indicating whether or not that's the case, or an error if the lookup fails.
func ExtractBuildNum ¶
ExtractBuildNum extracts the build number from the branch name, e.g. 13729 from release-R89-13729.B. Returns -1 if the branch name does not contain a build number.
func NewBranchName ¶
func NewBranchName(vinfo mv.VersionInfo, custom, descriptor string, release, factory, firmware, stabilize bool) string
NewBranchName determines the name for a new branch. By convention, standard branch names must end with the stripped version string from which they were created, followed by '.B'.
For example:
- A branch created from 1.0.0 must end with -1.B
- A branch created from 1.2.0 must end with -1.2.B
Release branches have a slightly different naming scheme. They include
the milestone from which they were created. Example: release-R12-1.2.B
func ParseBuildspec ¶
func ParseBuildspec(buildspec string) (*cv.VersionInfo, error)
ParseBuildspec returns version information for a buildspec path of the form 85/13277.0.0.xml.
func WhichVersionShouldBump ¶
func WhichVersionShouldBump(vinfo mv.VersionInfo) (mv.VersionComponent, error)
WhichVersionShouldBump returns which version is incremented by builds on a new branch.
Types ¶
type CheckoutOptions ¶
type CheckoutOptions struct { // If set, will get only this Ref. // If not set, will get the full repo. Ref string // To be used with the git clone --depth flag. Depth int }
CheckoutOptions describes how to check out a Git repo.
type Client ¶
type Client struct { // ManifestCheckout is a path to the manifest project checkout. ManifestCheckout string // WorkingManifest contains the working manifest this package // (i.e. the manifest being used as the source of truth). WorkingManifest repo.Manifest // StdoutLog contains the stdout logger for this client. StdoutLog *log.Logger // StderrLog contains the stderr logger for this client. StderrLog *log.Logger // FakeCreateRemoteBranchesAPI contains a fake version of the // CreateRemoteBranchesAPI function. If it is nil, the real function will // be used. This exists only for testing purposes. FakeCreateRemoteBranchesAPI func(authedClient *http.Client, branches []GerritProjectBranch, dryRun bool, gerritQPS float64) error }
Client provides various utility functions for branch_util.
func (*Client) AssertBranchesDoNotExist ¶
func (c *Client) AssertBranchesDoNotExist(branches []ProjectBranch, workerCount int) error
AssertBranchesDoNotExist checks that branches do not already exist.
func (*Client) BumpForCreate ¶
func (c *Client) BumpForCreate(componentToBump mv.VersionComponent, sourceVersion *mv.VersionInfo, release, push bool, branchName, sourceUpstream string) error
BumpForCreate bumps the version in mv.sh, as needed, in the source branch for a branch creation command.
func (*Client) CheckIfAlreadyBranched ¶
func (c *Client) CheckIfAlreadyBranched(vinfo mv.VersionInfo, manifestInternal repo.Project, force bool, branchType, branchName string) (bool, error)
CheckIfAlreadyBranched checks if there's already a branch for the desired new branch to create on the manifest-internal repo.
func (*Client) CreateRemoteBranches ¶
func (c *Client) CreateRemoteBranches(branches []ProjectBranch, dryRun, force bool, workerCount int) error
CreateRemoteBranches makes the requested branches on the remote Gerrit hosts using git checkouts and pushes.
func (*Client) CreateRemoteBranchesAPI ¶
func (c *Client) CreateRemoteBranchesAPI(authedClient *http.Client, branches []GerritProjectBranch, dryRun bool, gerritQPS float64, skipRetries bool, isTest bool) error
CreateRemoteBranchesAPI creates a bunch of branches on remote Gerrit instances for the specified inputs using the Gerrit API.
func (*Client) GerritProjectBranches ¶
func (c *Client) GerritProjectBranches(pbs []ProjectBranch) ([]GerritProjectBranch, error)
GerritProjectBranches creates a slice of GerritProjectBranch objects, which are representations of ProjectBranches that are useful for API based branching.
func (*Client) GetProjectCheckout ¶
func (c *Client) GetProjectCheckout(projectPath string, opts *CheckoutOptions) (string, error)
GetProjectCheckout gets a local checkout of a particular project.
func (*Client) InitWorkingManifest ¶
InitWorkingManifest initializes a branch client from a specified gerrit path.
func (*Client) ProjectBranches ¶
func (c *Client) ProjectBranches(br, original string) []ProjectBranch
ProjectBranches returns a list of ProjectBranch structs: one for each branchable project. The original parameter is the CrOS branch from which the current checkout stems.
func (*Client) ProjectFetchURL ¶
ProjectFetchURL returns the fetch URL for a remote Project.
func (*Client) RepairManifestRepositories ¶
func (c *Client) RepairManifestRepositories(branches []ProjectBranch, dryRun, force bool) error
RepairManifestRepositories repairs all manifests in all manifest repositories on the current branch and commits the changes. It then pushes the state of the local git branches to remote.
func (*Client) RepairManifestsOnDisk ¶
func (c *Client) RepairManifestsOnDisk(m *ManifestRepo, branchesByPath map[string]string) error
RepairManifestsOnDisk repairs the revision and upstream attributes of manifest elements on disk for the given projects.
type GerritProjectBranch ¶
type GerritProjectBranch struct { GerritURL string Project string ProjectPath string Branch string SrcRef string }
GerritProjectBranch contains all the details for creating a new Gerrit branch based on an existing one.
func GetNonManifestBranches ¶
func GetNonManifestBranches(branches []GerritProjectBranch) []GerritProjectBranch
GetNonManifestBranches filters out non-Manifest branches.
type ManifestRepo ¶
type ProjectBranch ¶
ProjectBranch is a project and a branch.