import "go.chromium.org/chromiumos/infra/go/internal/repo"
Copyright 2019 The Chromium OS Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2019 The Chromium OS Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
var ( GOB_HOST = "%s.googlesource.com" EXTERNAL_GOB_INSTANCE = "chromium" EXTERNAL_GOB_HOST = fmt.Sprintf(GOB_HOST, EXTERNAL_GOB_INSTANCE) EXTERNAL_GOB_URL = fmt.Sprintf("https://%s", EXTERNAL_GOB_HOST) INTERNAL_GOB_INSTANCE = "chrome-internal" INTERNAL_GOB_HOST = fmt.Sprintf(GOB_HOST, INTERNAL_GOB_INSTANCE) INTERNAL_GOB_URL = fmt.Sprintf("https://%s", INTERNAL_GOB_HOST) AOSP_GOB_INSTANCE = "android" AOSP_GOB_HOST = fmt.Sprintf(GOB_HOST, AOSP_GOB_INSTANCE) AOSP_GOB_URL = fmt.Sprintf("https://%s", AOSP_GOB_HOST) WEAVE_GOB_INSTANCE = "weave" WEAVE_GOB_HOST = fmt.Sprintf(GOB_HOST, WEAVE_GOB_INSTANCE) WEAVE_GOB_URL = fmt.Sprintf("https://%s", WEAVE_GOB_HOST) CROS_REMOTES = map[string]string{ "aosp": AOSP_GOB_URL, "weave": WEAVE_GOB_URL, // contains filtered or unexported fields } // Mapping 'remote name' -> regexp that matches names of repositories on // that remote that can be branched when creating CrOS branch. // Branching script will actually create a new git ref when branching // these projects. It won't attempt to create a git ref for other projects // that may be mentioned in a manifest. If a remote is missing from this // dictionary, all projects on that remote are considered to not be // branchable. BRANCHABLE_PROJECTS = map[string]*regexp.Regexp{ // contains filtered or unexported fields } MANIFEST_ATTR_BRANCHING_CREATE = "create" MANIFEST_ATTR_BRANCHING_PIN = "pin" MANIFEST_ATTR_BRANCHING_TOT = "tot" )
func GetRepoToRemoteBranchToSourceRootFromManifestFile(file string) (map[string]map[string]string, error)
func GetRepoToRemoteBranchToSourceRootFromManifests(authedClient *http.Client, ctx context.Context, gc *bbproto.GitilesCommit) (map[string]map[string]string, error)
GetRepoToSourceRootFromManifests constructs a Gerrit project to path mapping by fetching manifest XML files from Gitiles.
GetRepoToSourceRoot gets the mapping of Gerrit project to Chromium OS source tree path.
LoadManifestFromFileRaw loads the manifest at the given file and returns the file contents as a byte array.
LoadManifestTree loads the manifest at the given file path into a Manifest struct. It also loads all included manifests. Returns a map mapping manifest filenames to file contents.
type Annotation struct { Name string `xml:"name,attr,omitempty"` Value string `xml:"value,attr,omitempty"` }
Annotation is an element of a manifest annotating the parent element.
const ( UnspecifiedMode BranchMode = "unspecified" Pinned BranchMode = "pinned" Tot BranchMode = "tot" Create BranchMode = "create" )
type CopyFile struct { Dest string `xml:"dest,attr,omitempty"` Src string `xml:"src,attr,omitempty"` }
type Default struct { RemoteName string `xml:"remote,attr,omitempty"` Revision string `xml:"revision,attr,omitempty"` SyncJ string `xml:"sync-j,attr,omitempty"` }
Default is a manifest element that lists the default.
Include is a manifest element that imports another manifest file.
type Manifest struct { XMLName xml.Name `xml:"manifest"` Includes []Include `xml:"include"` Remotes []Remote `xml:"remote"` Default Default `xml:"default"` Notice string `xml:"notice,omitempty"` RepoHooks []RepoHooks `xml:"repo-hooks"` Projects []Project `xml:"project"` }
Manifest is a top-level Repo definition file.
LoadManifestFromFile loads the manifest at the given file into a Manifest struct.
LoadManifestFromFileWithIncludes loads the manifest at the given files but also calls MergeManifests to resolve includes.
MergeManifests will merge the given manifests based on includes, taking manifests[path] to be the top-level manifest. manifests maps manifest filenames to the Manifest structs themselves. This basically re-implements `repo manifest` but is necessary because we can't run `repo manifest` on a singular git repository.
GetMultiCheckoutProjects returns all projects in the manifest that have a multiple checkouts and are not pinned/tot.
GetPinnedProjects returns all projects in the manifest that are pinned.
GetProjectByName returns a pointer to the remote with the given path in the given manifest.
GetProjectByPath returns a pointer to the remote with the given path in the given manifest.
GetRemoteByName returns a pointer to the remote with the given name/alias in the given manifest.
GetSingleCheckoutProjects returns all projects in the manifest that have a single checkout and are not pinned/tot.
GetTotProjects returns all projects in the manifest that are tot.
GetUnique Project returns the unique project with the given name (nil if the project DNE). It returns an error if multiple projects with the given name exist.
func (m *Manifest) ProjectBranchMode(project Project) BranchMode
ProjectBranchMode returns the branch mode (create, pinned, tot) of a project.
ResolveImplicitLinks explicitly sets remote/revision information for each project in the manifest.
Write writes the manifest to the given path.
type Project struct { Path string `xml:"path,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Revision string `xml:"revision,attr,omitempty"` Upstream string `xml:"upstream,attr,omitempty"` RemoteName string `xml:"remote,attr,omitempty"` Annotations []Annotation `xml:"annotation"` Groups string `xml:"groups,attr,omitempty"` SyncC string `xml:"sync-c,attr,omitempty"` CopyFiles []CopyFile `xml:"copyfile"` }
Project is an element of a manifest containing a Gerrit project to source path definition.
GetAnnotation returns the value of the annotation with the given name, if it exists. It also returns a bool indicating whether or not the annotation exists.
type Remote struct { Fetch string `xml:"fetch,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Revision string `xml:"revision,attr,omitempty"` Alias string `xml:"alias,attr,omitempty"` }
Remote is a manifest element that lists a remote.
GitName returns the git name of the remote, which is Alias if it is set, and Name otherwise.
type RepoHooks struct { EnabledList string `xml:"enabled-list,attr,omitempty"` InProject string `xml:"in-project,attr,omitempty"` }
Package repo imports 16 packages (graph) and is imported by 7 packages. Updated 2021-01-26. Refresh now. Tools for package owners.