Documentation ¶
Overview ¶
Package workspace implements the toplevel abstraction of workspace.
Index ¶
- func Exists(dir string) bool
- type GetProjectsOptions
- type GitWorkSpace
- type RepoWorkSpace
- func (v RepoWorkSpace) AdminDir() string
- func (v *RepoWorkSpace) Config() goconfig.GitConfig
- func (v *RepoWorkSpace) FreezeManifest(fillUpstream bool) error
- func (v RepoWorkSpace) GetProjectWithPath(p string) *project.Project
- func (v RepoWorkSpace) GetProjects(o *GetProjectsOptions, args ...string) ([]*project.Project, error)
- func (v RepoWorkSpace) GetProjectsWithName(name string) []*project.Project
- func (v RepoWorkSpace) IsMirror() bool
- func (v RepoWorkSpace) IsSingle() bool
- func (v *RepoWorkSpace) LinkManifest() error
- func (v *RepoWorkSpace) LoadRemotes(noCache bool) error
- func (v *RepoWorkSpace) ManifestURL() string
- func (v *RepoWorkSpace) Override(name string) error
- func (v *RepoWorkSpace) SaveConfig(cfg goconfig.GitConfig) error
- func (v *RepoWorkSpace) Settings() *project.RepoSettings
- func (v *RepoWorkSpace) ShortGitDir(pathName string) string
- func (v *RepoWorkSpace) ShortGitObjectsDir(name string) string
- func (v *RepoWorkSpace) UpdateProjectList(submodulesOK bool) ([]string, error)
- type WorkSpace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GetProjectsOptions ¶
GetProjectsOptions is options for GetProjects() function.
type GitWorkSpace ¶
type GitWorkSpace struct { RootDir string GitDir string Manifest *manifest.Manifest ManifestProject *project.ManifestProject Projects []*project.Project // contains filtered or unexported fields }
GitWorkSpace defines structure for single git workspace.
func NewGitWorkSpace ¶
func NewGitWorkSpace(dir string) (*GitWorkSpace, error)
NewGitWorkSpace returns workspace interface for single git repository.
func (GitWorkSpace) GetProjects ¶
func (v GitWorkSpace) GetProjects(*GetProjectsOptions, ...string) ([]*project.Project, error)
GetProjects returns all projects.
func (GitWorkSpace) IsMirror ¶
func (v GitWorkSpace) IsMirror() bool
IsMirror is false for git workspace.
func (GitWorkSpace) IsSingle ¶
func (v GitWorkSpace) IsSingle() bool
IsSingle is true for git workspace.
func (*GitWorkSpace) LoadRemotes ¶
func (v *GitWorkSpace) LoadRemotes(noCache bool) error
LoadRemotes implements LoadRemotes interface.
type RepoWorkSpace ¶
type RepoWorkSpace struct { RootDir string Manifest *manifest.Manifest ManifestProject *project.ManifestProject Projects []*project.Project // contains filtered or unexported fields }
RepoWorkSpace is the toplevel structure for manipulating git-repo worktree.
func NewEmptyRepoWorkSpace ¶
func NewEmptyRepoWorkSpace(dir, manifestURL string) (*RepoWorkSpace, error)
NewEmptyRepoWorkSpace returns empty workspace for new created workspace.
func NewRepoWorkSpace ¶
func NewRepoWorkSpace(dir string) (*RepoWorkSpace, error)
NewRepoWorkSpace finds and loads repo workspace. Will return an error if not found.
1. Searching a hidden `.repo` directory in `<dir>` or any parent directory. 2. Returns a RepoWorkSpace objects based on the toplevel directory of workspace. 3. If cannot find valid repo workspace, return ErrRepoDirNotFound error.
func (RepoWorkSpace) AdminDir ¶
func (v RepoWorkSpace) AdminDir() string
AdminDir returns .repo dir.
func (*RepoWorkSpace) Config ¶
func (v *RepoWorkSpace) Config() goconfig.GitConfig
Config returns git config file parser.
func (*RepoWorkSpace) FreezeManifest ¶
func (v *RepoWorkSpace) FreezeManifest(fillUpstream bool) error
FreezeManifest changes projects of manifest, and set revision of project to fixed revision.
func (RepoWorkSpace) GetProjectWithPath ¶
func (v RepoWorkSpace) GetProjectWithPath(p string) *project.Project
GetProjectWithPath returns project which has matching path.
func (RepoWorkSpace) GetProjects ¶
func (v RepoWorkSpace) GetProjects(o *GetProjectsOptions, args ...string) ([]*project.Project, error)
GetProjects returns all matching projects.
func (RepoWorkSpace) GetProjectsWithName ¶
func (v RepoWorkSpace) GetProjectsWithName(name string) []*project.Project
GetProjectsWithName returns projects which has matching name.
func (RepoWorkSpace) IsMirror ¶
func (v RepoWorkSpace) IsMirror() bool
IsMirror indicates whether repo is in mirror mode
func (RepoWorkSpace) IsSingle ¶
func (v RepoWorkSpace) IsSingle() bool
IsSingle is false for workspace initialized by manifests project.
func (*RepoWorkSpace) LinkManifest ¶
func (v *RepoWorkSpace) LinkManifest() error
LinkManifest creates link of manifest.xml.
func (*RepoWorkSpace) LoadRemotes ¶
func (v *RepoWorkSpace) LoadRemotes(noCache bool) error
LoadRemotes calls remote API to get server type and other info.
func (*RepoWorkSpace) ManifestURL ¶
func (v *RepoWorkSpace) ManifestURL() string
ManifestURL returns URL of manifest project.
func (*RepoWorkSpace) Override ¶
func (v *RepoWorkSpace) Override(name string) error
Override will read alternate manifest XML file to initialize workspace.
func (*RepoWorkSpace) SaveConfig ¶
func (v *RepoWorkSpace) SaveConfig(cfg goconfig.GitConfig) error
SaveConfig will save config to git config file.
func (*RepoWorkSpace) Settings ¶
func (v *RepoWorkSpace) Settings() *project.RepoSettings
Settings returns manifest project's Settings.
func (*RepoWorkSpace) ShortGitDir ¶ added in v0.7.8
func (v *RepoWorkSpace) ShortGitDir(pathName string) string
ShortGitDir is relative path of gitdir
func (*RepoWorkSpace) ShortGitObjectsDir ¶ added in v0.7.8
func (v *RepoWorkSpace) ShortGitObjectsDir(name string) string
ShortGitObjectsDir is relative path of shared objects gitdir
func (*RepoWorkSpace) UpdateProjectList ¶ added in v0.7.8
func (v *RepoWorkSpace) UpdateProjectList(submodulesOK bool) ([]string, error)
UpdateProjectList updates `project.list` file and try to remove obsolete projects.
type WorkSpace ¶
type WorkSpace interface { AdminDir() string LoadRemotes(bool) error IsSingle() bool IsMirror() bool GetProjects(*GetProjectsOptions, ...string) ([]*project.Project, error) }
WorkSpace is interface for workspace, implemented with repo workspace or single git workspace.
func NewWorkSpace ¶
NewWorkSpace returns workspace instance.