Documentation ¶
Overview ¶
Package repo contains functions for interacting with manifests and the repo tool.
Package repo contains functions for interacting with manifests and the repo tool.
Index ¶
- Variables
- func EnsureRepoTool() (string, func(), error)
- func GetRepoToSourceRoot(chromiumosCheckout, repoToolPath string) (map[string]string, error)
- func Init(ctx context.Context, path, repoToolPath string, initArgs InitArgs) error
- func Sync(ctx context.Context, path, repoToolPath string) error
- type Annotation
- type BranchMode
- type CopyFile
- type Default
- type Include
- type InitArgs
- type Manifest
- func (m *Manifest) GetMultiCheckoutProjects() []*Project
- func (m *Manifest) GetPinnedProjects() []*Project
- func (m *Manifest) GetProjectByName(name string) (*Project, error)
- func (m *Manifest) GetProjectByPath(path string) (*Project, error)
- func (m *Manifest) GetRemoteByName(name string) *Remote
- func (m *Manifest) GetSingleCheckoutProjects() []*Project
- func (m *Manifest) GetTotProjects() []*Project
- func (m *Manifest) GetUniqueProject(name string) (Project, error)
- func (m *Manifest) ProjectBranchMode(project Project) BranchMode
- func (m *Manifest) ResolveImplicitLinks()
- func (m *Manifest) ToBytes() ([]byte, error)
- func (m *Manifest) Write(path string) error
- type Project
- type Remote
- type RepoHooks
Constants ¶
This section is empty.
Variables ¶
var ( // CommandRunnerImpl exists for testing purposes. CommandRunnerImpl cmd.CommandRunner = cmd.RealCommandRunner{} )
Functions ¶
func EnsureRepoTool ¶
Ensure that the repo tool is installed. Returns path of tool, cleanup and error.
func GetRepoToSourceRoot ¶
GetRepoToSourceRoot gets the mapping of Gerrit project to Chromium OS source tree path.
Types ¶
type Annotation ¶
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.
type BranchMode ¶
type BranchMode string
BranchMode is a particular branching mode (Pinned, ToT, Create).
const ( // UnspecifiedMode is an unspecified branch mode. UnspecifiedMode BranchMode = "unspecified" // Pinned branch mode. Pinned BranchMode = "pinned" // Tot branch mode. Tot BranchMode = "tot" // Create branch mode. Create BranchMode = "create" )
type CopyFile ¶
type CopyFile struct { Dest string `xml:"dest,attr,omitempty"` Src string `xml:"src,attr,omitempty"` }
CopyFile is a manifest element that lists a copy setting.
type Default ¶
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.
type Include ¶
type Include struct {
Name string `xml:"name,attr,omitempty"`
}
Include is a manifest element that imports another manifest file.
type Manifest ¶
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.
func MergeManifests ¶
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.
func ParseManifest ¶
ParseManifest parses a manifest from the given byte array.
func (*Manifest) GetMultiCheckoutProjects ¶
GetMultiCheckoutProjects returns all projects in the manifest that have a multiple checkouts and are not pinned/tot.
func (*Manifest) GetPinnedProjects ¶
GetPinnedProjects returns all projects in the manifest that are pinned.
func (*Manifest) GetProjectByName ¶
GetProjectByName returns a pointer to the remote with the given path in the given manifest.
func (*Manifest) GetProjectByPath ¶
GetProjectByPath returns a pointer to the remote with the given path in the given manifest.
func (*Manifest) GetRemoteByName ¶
GetRemoteByName returns a pointer to the remote with the given name/alias in the given manifest.
func (*Manifest) GetSingleCheckoutProjects ¶
GetSingleCheckoutProjects returns all projects in the manifest that have a single checkout and are not pinned/tot.
func (*Manifest) GetTotProjects ¶
GetTotProjects returns all projects in the manifest that are tot.
func (*Manifest) GetUniqueProject ¶
GetUniqueProject 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 (*Manifest) ProjectBranchMode ¶
func (m *Manifest) ProjectBranchMode(project Project) BranchMode
ProjectBranchMode returns the branch mode (create, pinned, tot) of a project.
func (*Manifest) ResolveImplicitLinks ¶
func (m *Manifest) ResolveImplicitLinks()
ResolveImplicitLinks explicitly sets remote/revision information for each project in the manifest.
type Project ¶
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.
type Remote ¶
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"` Annotations []Annotation `xml:"annotation"` }
Remote is a manifest element that lists a remote.
func (*Remote) GetAnnotation ¶
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.