vcs

package
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// VCSTestRepoURL is the URL of the HTTP server that serves the repos for
	// vcs-test.golang.org.
	//
	// In tests, this is set to the URL of an httptest.Server hosting a
	// cmd/go/internal/vcweb.Server.
	VCSTestRepoURL string

	// VCSTestHosts is the set of hosts supported by the vcs-test server.
	VCSTestHosts []string

	// VCSTestIsLocalHost reports whether the given URL refers to a local
	// (loopback) host, such as "localhost" or "127.0.0.1:8080".
	VCSTestIsLocalHost func(*urlpkg.URL) bool
)

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Name      string
	Cmd       string
	RootNames []rootName

	CreateCmd   []string
	DownloadCmd []string

	TagCmd         []tagCmd
	TagLookupCmd   []tagCmd
	TagSyncCmd     []string
	TagSyncDefault []string

	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)
	Status      func(v *Cmd, rootDir string) (Status, error)
}

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

func FromDir

func FromDir(dir, srcRoot string, allowNesting bool) (repoDir string, vcsCmd *Cmd, err error)

FromDir inspects dir and its parents to determine the version control system and code repository to use. If no repository is found, FromDir returns an error equivalent to os.ErrNotExist.

func (*Cmd) Create

func (v *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) Download

func (v *Cmd) Download(dir string) error

Download downloads any new changes for the repo in dir.

func (*Cmd) IsSecure

func (v *Cmd) IsSecure(repo string) bool

func (*Cmd) Ping

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

Ping pings to determine scheme to use.

func (*Cmd) String

func (v *Cmd) String() string

func (*Cmd) TagSync

func (v *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

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

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

type ImportMismatchError

type ImportMismatchError struct {
	// contains filtered or unexported fields
}

An ImportMismatchError is returned where metaImport/s are present but none match our import path.

func (ImportMismatchError) Error

func (m ImportMismatchError) Error() string

type ModuleMode

type ModuleMode int

ModuleMode specifies whether to prefer modules when looking up code sources.

const (
	IgnoreMod ModuleMode = iota
	PreferMod
)

type RepoRoot

type RepoRoot struct {
	Repo     string
	Root     string
	IsCustom bool
	VCS      *Cmd
}

RepoRoot describes the repository root for a tree of source code.

func RepoRootForImportPath

func RepoRootForImportPath(importPath string, mod ModuleMode, security web.SecurityMode) (*RepoRoot, error)

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

type Status

type Status struct {
	Revision    string
	CommitTime  time.Time
	Uncommitted bool
}

Status is the current state of a local repository.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL