import "golang.org/x/tools/go/vcs"
Package vcs exposes functions for resolving import paths and using version control systems, which can be used to implement behavior similar to the standard "go get" command.
This package is a copy of internal code in package cmd/go/internal/get, modified to make the identifiers exported. It's provided here for developers who want to write tools with similar semantics. It needs to be manually kept in sync with upstream when changes are made to cmd/go/internal/get; see https://golang.org/issue/11490.
discovery.go env.go http.go vcs.go
ShowCmd controls whether VCS commands are printed.
Verbose enables verbose operation logging.
type Cmd struct { Name string Cmd string // name of binary to invoke command CreateCmd string // command to download a fresh copy of a repository DownloadCmd string // command to download updates into an existing repository TagCmd []TagCmd // commands to list tags TagLookupCmd []TagCmd // commands to lookup tags before running tagSyncCmd TagSyncCmd string // command to sync to specific tag TagSyncDefault string // command to sync to default tag LogCmd string // command to list repository changelogs in an XML format Scheme []string PingCmd string }
A Cmd describes how to use a version control system like Mercurial, Git, or Subversion.
ByCmd returns the version control system for the given command name (hg, git, svn, bzr).
FromDir inspects dir and its parents to determine the version control system and code repository to use. On return, root is the import path corresponding to the root of the repository.
Create creates a new copy of repo in dir. The parent of dir must exist; dir must not.
CreateAtRev creates a new copy of repo in dir at revision rev. The parent of dir must exist; dir must not. rev must be a valid revision in repo.
Download downloads any new changes for the repo in dir. dir must be a valid VCS repo compatible with v.
Log logs the changes for the repo in dir. dir must be a valid VCS repo compatible with v.
LogAtRev logs the change for repo in dir at the rev revision. dir must be a valid VCS repo compatible with v. rev must be a valid revision for the repo in dir.
Ping pings the repo to determine if scheme used is valid. This repo must be pingable with this scheme and VCS.
TagSync syncs the repo in dir to the named tag, which is either a tag returned by Tags or the empty string (the default tag). dir must be a valid VCS repo compatible with v and the tag must exist.
Tags returns the list of available tags for the repo in dir. dir must be a valid VCS repo compatible with v.
type RepoRoot struct { VCS *Cmd // Repo is the repository URL, including scheme. Repo string // Root is the import path corresponding to the root of the // repository. Root string }
RepoRoot represents a version control system, a repo, and a root of where to put it on disk.
RepoRootForImportDynamic finds a *RepoRoot for a custom domain that's not statically known by RepoRootForImportPathStatic.
This handles custom import paths like "name.tld/pkg/foo" or just "name.tld".
RepoRootForImportPath analyzes importPath to determine the version control system, and code repository to use.
RepoRootForImportPathStatic attempts to map importPath to a RepoRoot using the commonly-used VCS hosting sites in vcsPaths (github.com/user/dir), or from a fully-qualified importPath already containing its VCS type (foo.com/repo.git/dir)
If scheme is non-empty, that scheme is forced.
type TagCmd struct { Cmd string // command to list tags Pattern string // regexp to extract tags from list }
A TagCmd describes a command to list available tags that can be passed to Cmd.TagSyncCmd.
Package vcs imports 16 packages (graph) and is imported by 120 packages. Updated 2019-12-14. Refresh now. Tools for package owners.