govend: github.com/govend/govend/deps/vcs Index | Files | Directories

package vcs

import "github.com/govend/govend/deps/vcs"

Package vcs provides methods for VCS.

Index

Package Files

discovery.go env.go http.go vcs.go

Constants

const (
    Secure securityMode = iota
    Insecure
)

Security mode options

Variables

var Bzr = &Cmd{
    Name: "Bazaar",
    Cmd:  "bzr",

    CreateCmd: []string{"branch {repo} {dir}"},

    DownloadCmd: []string{"pull --overwrite"},

    TagCmd:         []TagCmd{{"tags", `^(\S+)`}},
    TagSyncCmd:     "update -r {tag}",
    TagSyncDefault: "update -r revno:-1",

    Scheme:      []string{"https", "http", "bzr", "bzr+ssh"},
    PingCmd:     "info {scheme}://{repo}",
    RemoteRepo:  bzrRemoteRepo,
    ResolveRepo: bzrResolveRepo,
}

Bzr describes how to use Bazaar.

var Git = &Cmd{
    Name: "Git",
    Cmd:  "git",

    CreateCmd:   []string{"clone {repo} {dir}", "-go-internal-cd {dir} submodule update --init --recursive"},
    DownloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"},

    TagCmd: []TagCmd{

        {"show-ref", `(?:tags|origin)/(\S+)$`},
    },
    TagLookupCmd: []TagCmd{
        {"show-ref tags/{tag} origin/{tag}", `((?:tags|origin)/\S+)$`},
    },
    TagSyncCmd:     "checkout {tag}",
    TagSyncDefault: "checkout master",

    Scheme:     []string{"git", "https", "http", "git+ssh", "ssh"},
    PingCmd:    "ls-remote {scheme}://{repo}",
    RemoteRepo: gitRemoteRepo,
}

Git describes how to use Git.

var Hg = &Cmd{
    Name: "Mercurial",
    Cmd:  "hg",

    CreateCmd:   []string{"clone -U {repo} {dir}"},
    DownloadCmd: []string{"pull"},

    TagCmd: []TagCmd{
        {"tags", `^(\S+)`},
        {"branches", `^(\S+)`},
    },
    TagSyncCmd:     "update -r {tag}",
    TagSyncDefault: "update default",

    Scheme:     []string{"https", "http", "ssh"},
    PingCmd:    "identify {scheme}://{repo}",
    RemoteRepo: hgRemoteRepo,
}

Hg describes how to use Mercurial.

var List = []*Cmd{
    Hg,
    Git,
    Svn,
    Bzr,
}

List lists the known version control systems

var ShowCmd bool

ShowCmd controls whether VCS commands are printed.

var Svn = &Cmd{
    Name: "Subversion",
    Cmd:  "svn",

    CreateCmd:   []string{"checkout {repo} {dir}"},
    DownloadCmd: []string{"update"},

    Scheme:     []string{"https", "http", "svn", "svn+ssh"},
    PingCmd:    "info {scheme}://{repo}",
    RemoteRepo: svnRemoteRepo,
}

Svn describes how to use Subversion.

var Verbose bool

Verbose enables verbose operation logging.

func HTTPSorHTTP Uses

func HTTPSorHTTP(importPath string, security securityMode, verbose bool) (urlStr string, body io.ReadCloser, err error)

HTTPSorHTTP returns the body of either the importPath's https resource or, if unavailable, the http resource.

func MetaImportsForPrefix Uses

func MetaImportsForPrefix(importPrefix string, security securityMode, verbose bool) (urlStr string, imports []MetaImport, err error)

MetaImportsForPrefix takes a package's root import path as declared in a <meta> tag and returns its HTML discovery URL and the parsed metaImport lines found on the page.

The importPath is of the form "golang.org/x/tools". It is an error if no imports are found. urlStr will still be valid if err != nil. The returned urlStr will be of the form "https://golang.org/x/tools?go-get=1"

func ParseMetaGoImports Uses

func ParseMetaGoImports(r io.Reader) (imports []MetaImport, err error)

ParseMetaGoImports returns meta imports from the HTML in r. Parsing ends at the end of the <head> section or the beginning of the <body>.

type Cmd Uses

type Cmd struct {
    Name string
    Cmd  string // name of binary to invoke command

    CreateCmd   []string // commands to download a fresh copy of a repository
    DownloadCmd []string // commands to download updates into an existing repository

    TagCmd         []TagCmd // commands to list tags
    TagLookupCmd   []TagCmd // commands to lookup tags before running tagSyncCmd
    TagSyncCmd     string   // commands to sync to specific tag
    TagSyncDefault string   // commands to sync to default tag

    Scheme  []string
    PingCmd string

    RemoteRepo  func(v *Cmd, rootDir string) (remoteRepo string, err error)
    ResolveRepo func(v *Cmd, rootDir, remoteRepo string) (realRepo string, err error)
}

A Cmd describes how to use a version control system like Mercurial, Git, or Subversion.

func ByCmd Uses

func ByCmd(cmd string) *Cmd

ByCmd returns the version control system for the given command name (hg, git, svn, bzr).

func FromDir Uses

func FromDir(dir, srcRoot string) (vcs *Cmd, root string, err error)

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 (thus root is a prefix of importPath).

func (*Cmd) Create Uses

func (c *Cmd) Create(dir, repo string) error

Create creates a new copy of repo in dir. The parent of dir must exist; dir must not.

func (*Cmd) CreateAtRev Uses

func (c *Cmd) CreateAtRev(dir, repo, rev string) error

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.

func (*Cmd) Download Uses

func (c *Cmd) Download(dir string, verbose bool) error

Download downloads any new changes for the repo in dir.

func (*Cmd) Ping Uses

func (c *Cmd) Ping(scheme, repo string) error

Ping pings to determine scheme to use.

func (*Cmd) String Uses

func (c *Cmd) String() string

func (*Cmd) TagSync Uses

func (c *Cmd) TagSync(dir, tag string) error

TagSync syncs the repo in dir to the named tag, which either is a tag returned by tags or is v.tagDefault.

func (*Cmd) Tags Uses

func (c *Cmd) Tags(dir string) ([]string, error)

Tags returns the list of available tags for the repo in dir.

type MetaImport Uses

type MetaImport struct {
    Prefix, VCS, RepoRoot string
}

MetaImport represents the parsed <meta name="go-import" content="prefix vcs reporoot" /> tags from HTML files.

type RepoRoot Uses

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.

func RepoRootForImportDynamic Uses

func RepoRootForImportDynamic(importPath string, security securityMode, verbose bool) (*RepoRoot, error)

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".

func RepoRootForImportPath Uses

func RepoRootForImportPath(importPath string, security securityMode, verbose bool) (*RepoRoot, error)

RepoRootForImportPath analyzes importPath to determine the version control system, and code repository to use.

func RepoRootFromVCSPaths Uses

func RepoRootFromVCSPaths(importPath, scheme string, security securityMode, vcsPaths []*vcsPath) (*RepoRoot, error)

RepoRootFromVCSPaths attempts to map importPath to a repoRoot using the mappings defined in vcsPaths. If scheme is non-empty, that scheme is forced.

type TagCmd Uses

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 tagSyncCmd.

Directories

PathSynopsis
internal/singleflightPackage singleflight provides a duplicate function call suppression mechanism.

Package vcs imports 19 packages (graph) and is imported by 11 packages. Updated 2016-08-02. Refresh now. Tools for package owners.