Documentation ¶
Index ¶
- Variables
- func FetchMetadata(path string, insecure bool) (rc io.ReadCloser, err error)
- func ParseImports(root, vendorRoot, vendorPrefix string, tests, all bool) (map[string]bool, error)
- func ParseMetadata(path string, insecure bool) (string, string, string, error)
- func WriteManifest(path string, m *Manifest) error
- type BzrClone
- type Dependency
- type GitClone
- type HgClone
- type Manifest
- func (m *Manifest) AddDependency(dep Dependency) error
- func (m *Manifest) GetDependencyForImportpath(path string) (Dependency, error)
- func (m *Manifest) GetSubpackages(path string) (deps []Dependency)
- func (m *Manifest) HasImportpath(path string) bool
- func (m *Manifest) RemoveDependency(dep Dependency) error
- type RemoteRepo
- func Bzrrepo(url string) (RemoteRepo, error)
- func DeduceRemoteRepo(path string, insecure bool) (RemoteRepo, string, error)
- func Gitrepo(url *url.URL, insecure bool, schemes ...string) (RemoteRepo, error)
- func Hgrepo(u *url.URL, insecure bool, schemes ...string) (RemoteRepo, error)
- func NewRemoteRepo(repoURL, vcs string, insecure bool) (RemoteRepo, error)
- type WorkingCopy
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func FetchMetadata ¶
func FetchMetadata(path string, insecure bool) (rc io.ReadCloser, err error)
FetchMetadata fetchs the remote metadata for path.
func ParseImports ¶
ParseImports parses Go packages from a specific root returning a set of import paths. vendorRoot is how deep to go looking for vendor folders, usually the repo root. vendorPrefix is the vendorRoot import path.
func ParseMetadata ¶
ParseMetadata fetchs and decodes remote metadata for path.
func WriteManifest ¶
WriteManifest writes a Manifest to the path. If the manifest does not exist, it is created. If it does exist, it will be overwritten. If the manifest file is empty (0 dependencies) it will be deleted. The dependencies will be ordered by import path to reduce churn when making changes. TODO(dfc) write to temporary file and move atomically to avoid destroying a working vendorfile.
Types ¶
type BzrClone ¶
type BzrClone struct {
// contains filtered or unexported fields
}
BzrClone is a bazaar WorkingCopy.
type Dependency ¶
type Dependency struct { // Importpath is name by which this dependency is known. Importpath string `json:"importpath"` // Repository is the remote DVCS location that this // dependency was fetched from. Repository string `json:"repository"` // VCS is the DVCS system found at Repository. VCS string `json:"vcs"` // Revision is the revision that describes the dependency's // remote revision. Revision string `json:"revision"` // Branch is the branch the Revision was located on. // Can be blank if not needed. Branch string `json:"branch"` // Path is the path inside the Repository where the // dependency was fetched from. Path string `json:"path,omitempty"` // NoTests indicates that test files were ignored. // In the negative for backwards compatibility. NoTests bool `json:"notests,omitempty"` // AllFiles indicates that no files were ignored. AllFiles bool `json:"allfiles,omitempty"` }
Dependency describes one vendored import path of code A Dependency is an Importpath sources from a Respository at Revision from Path.
type GitClone ¶
type GitClone struct {
// contains filtered or unexported fields
}
GitClone is a git WorkingCopy.
type HgClone ¶
type HgClone struct {
// contains filtered or unexported fields
}
HgClone is a mercurial WorkingCopy.
type Manifest ¶
type Manifest struct { // Manifest version. Current manifest version is 0. Version int `json:"version"` // Depenencies is a list of vendored dependencies. Dependencies []Dependency `json:"dependencies"` }
Manifest describes the layout of $PROJECT/vendor/manifest.
func ReadManifest ¶
ReadManifest reads a Manifest from path. If the Manifest is not found, a blank Manifest will be returned.
func (*Manifest) AddDependency ¶
func (m *Manifest) AddDependency(dep Dependency) error
AddDependency adds a Dependency to the current Manifest. If the dependency exists already then it returns and error.
func (*Manifest) GetDependencyForImportpath ¶
func (m *Manifest) GetDependencyForImportpath(path string) (Dependency, error)
GetDependencyForRepository return a dependency for specified import path. Note that it might be a parent of the specified path. If the dependency does not exist it returns an error.
func (*Manifest) GetSubpackages ¶
func (m *Manifest) GetSubpackages(path string) (deps []Dependency)
GetSubpackages returns any Dependency in the Manifest that is a subpackage of the given import path.
func (*Manifest) HasImportpath ¶
HasImportpath reports whether the Manifest contains the import path, or a parent of it.
func (*Manifest) RemoveDependency ¶
func (m *Manifest) RemoveDependency(dep Dependency) error
RemoveDependency removes a Dependency from the current Manifest. If the dependency does not exist then it returns an error.
type RemoteRepo ¶
type RemoteRepo interface { // Checkout checks out a specific branch, tag, or revision. // The interpretation of these three values is impementation // specific. Checkout(branch, tag, revision string) (WorkingCopy, error) // URL returns the URL the clone was/will be taken from. URL() string // Type returns the repository type (git, hg, ...) Type() string }
RemoteRepo describes a remote dvcs repository.
func Bzrrepo ¶
func Bzrrepo(url string) (RemoteRepo, error)
Bzrrepo returns a RemoteRepo representing a remote bzr repository.
func DeduceRemoteRepo ¶
func DeduceRemoteRepo(path string, insecure bool) (RemoteRepo, string, error)
DeduceRemoteRepo takes a potential import path and returns a RemoteRepo representing the remote location of the source of an import path. Remote repositories can be bare import paths, or urls including a checkout scheme. If deduction would cause traversal of an insecure host, a message will be printed and the travelsal path will be ignored.
func NewRemoteRepo ¶
func NewRemoteRepo(repoURL, vcs string, insecure bool) (RemoteRepo, error)
type WorkingCopy ¶
type WorkingCopy interface { // Dir is the root of this working copy. Dir() string // Revision returns the revision of this working copy. Revision() (string, error) // Branch returns the branch to which this working copy belongs. Branch() (string, error) // Destroy removes the working copy. Destroy() error }
WorkingCopy represents a local copy of a remote dvcs repository.