package vcs

Import Path
	go.pact.im/x/goship/internal/vcs (on go.dev)

Dependency Relation
	imports 12 packages, and imported by 11 packages

Involved Source Files backend.go Package vcs defines the pluggable, VCS-agnostic version control abstraction used by goship. helpers.go registry.go
Package-Level Type Names (total 10, all are exported)
/* sort exporteds by: | */
CommitOptions configures a VCS-agnostic commit. Backend-specific options (such as GPG/SSH signing) live in each backend’s own configuration. Message string func Session.Commit(ctx context.Context, files []string, opts CommitOptions) (string, error)
Exporter is an optional interface that VCS backends may implement to export the full tracked file tree at rev into destDir in a single operation (for example via "git archive" or "hg archive") rather than per-file reads. ( Exporter) Export(ctx context.Context, rev, destDir string) error *go.pact.im/x/goship/internal/vcs/fossilvcs.Repo *go.pact.im/x/goship/internal/vcs/gitvcs.Repo *go.pact.im/x/goship/internal/vcs/hgvcs.Repo *go.pact.im/x/goship/internal/vcs/jjvcs.Repo
FileEntry describes a single tracked file in a VCS tree. Mode is the file mode (notably executable bit 0o111). Path is the repository-relative slash-separated path. func Session.ListFiles(ctx context.Context, dir string) ([]FileEntry, error) func VCS.ListFiles(ctx context.Context, rev, dir string) ([]FileEntry, error) func go.pact.im/x/goship/internal/vcs/fossilvcs.(*Repo).ListFiles(ctx context.Context, rev, dir string) ([]FileEntry, error) func go.pact.im/x/goship/internal/vcs/gitvcs.(*Repo).ListFiles(ctx context.Context, rev, dir string) ([]FileEntry, error) func go.pact.im/x/goship/internal/vcs/hgvcs.(*Repo).ListFiles(ctx context.Context, rev, dir string) ([]FileEntry, error) func go.pact.im/x/goship/internal/vcs/jjvcs.(*Repo).ListFiles(ctx context.Context, rev, dir string) ([]FileEntry, error) func go.pact.im/x/goship/internal/vcs/memvcs.(*Repo).ListFiles(_ context.Context, rev, dir string) ([]FileEntry, error) func go.pact.im/x/goship/internal/modsum.Compute(rootDir, modDir, modPath, ver string, tracked []FileEntry) (modsum.Checksums, error) func go.pact.im/x/goship/internal/modsum.ComputeFS(fsys fs.FS, modDir, modPath, ver string, tracked []FileEntry) (modsum.Checksums, error)
Opener attempts to open a VCS repository containing dir. Name string Open func(ctx context.Context, dir string) (VCS, error) func go.pact.im/x/goship/internal/vcs/fossilvcs.Opener(cfg fossilvcs.Config) Opener func go.pact.im/x/goship/internal/vcs/gitvcs.Opener(cfg gitvcs.Config) Opener func go.pact.im/x/goship/internal/vcs/hgvcs.Opener(cfg hgvcs.Config) Opener func go.pact.im/x/goship/internal/vcs/jjvcs.Opener(cfg jjvcs.Config) Opener func NewRegistry(openers ...Opener) *Registry
PublishResult summarizes the commits and tags finalized by Session.Publish. FinalID string Label string PushHint string Ref string StartID string Tags []string func Session.Publish(ctx context.Context) (PublishResult, error) func VCS.PushHint(remote string, res PublishResult) string func go.pact.im/x/goship/internal/vcs/fossilvcs.(*Repo).PushHint(remote string, _ PublishResult) string func go.pact.im/x/goship/internal/vcs/gitvcs.(*Repo).PushHint(remote string, res PublishResult) string func go.pact.im/x/goship/internal/vcs/hgvcs.(*Repo).PushHint(remote string, _ PublishResult) string func go.pact.im/x/goship/internal/vcs/jjvcs.(*Repo).PushHint(remote string, res PublishResult) string func go.pact.im/x/goship/internal/vcs/memvcs.(*Repo).PushHint(remote string, res PublishResult) string
Registry holds available VCS backend openers without using global mutable state. Names returns the registered backend names. Open opens the repository at dir using the named backend, or auto-detects when name is "" or "auto". func NewRegistry(openers ...Opener) *Registry
Revision identifies a resolved VCS commit and optional movable reference (such as a Git branch, Mercurial bookmark/branch, Fossil branch, or Jujutsu bookmark). ID is the immutable revision identifier (e.g. a commit hash). Label is the human-friendly ref name (e.g. "main", "default", "trunk"). Ref is the backend-specific canonical ref name, if any. func VCS.ResolveRev(ctx context.Context, rev string) (Revision, error) func go.pact.im/x/goship/internal/vcs/fossilvcs.(*Repo).ResolveRev(ctx context.Context, rev string) (Revision, error) func go.pact.im/x/goship/internal/vcs/gitvcs.(*Repo).ResolveRev(ctx context.Context, rev string) (Revision, error) func go.pact.im/x/goship/internal/vcs/hgvcs.(*Repo).ResolveRev(ctx context.Context, rev string) (Revision, error) func go.pact.im/x/goship/internal/vcs/jjvcs.(*Repo).ResolveRev(ctx context.Context, rev string) (Revision, error) func go.pact.im/x/goship/internal/vcs/memvcs.(*Repo).ResolveRev(_ context.Context, rev string) (Revision, error) func VCS.Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/fossilvcs.(*Repo).Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/gitvcs.(*Repo).Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/hgvcs.(*Repo).Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/jjvcs.(*Repo).Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/memvcs.(*Repo).Begin(_ context.Context, rev Revision) (Session, error)
Session represents an isolated transactional workspace for creating release commits and tags without directly exposing local filesystem paths to callers. Close releases temporary resources. Calling Close without Publish leaves the repository unmodified. Commit stages files (repo-relative slash paths) and creates a commit. FS returns a read-only filesystem view of the session’s working tree. Head returns the current revision ID inside this session. ListFiles returns all VCS-tracked files at the session’s current HEAD under dir ("" or "." for the whole repository). Publish finalizes all commits and tags into the repository. Tag records a tag at the session’s current HEAD. WriteFile writes data to a repo-relative slash path in the session’s working tree. Session : io.Closer func VCS.Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/fossilvcs.(*Repo).Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/gitvcs.(*Repo).Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/hgvcs.(*Repo).Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/jjvcs.(*Repo).Begin(ctx context.Context, rev Revision) (Session, error) func go.pact.im/x/goship/internal/vcs/memvcs.(*Repo).Begin(_ context.Context, rev Revision) (Session, error)
TagOptions configures a VCS-agnostic tag. Backend-specific options (such as annotated vs lightweight tags or tag commit messages) live in each backend’s own configuration. Message string func Session.Tag(ctx context.Context, name string, opts TagOptions) error
VCS provides repository inspection, transactional release sessions, and push operations for a specific version control system. Begin starts an isolated release transaction rooted at rev. ChangedFiles returns repo-relative slash paths changed between baseRev and targetRev under dir ("" or "." for the whole repository). ListFiles returns all VCS-tracked files at rev under dir. Name returns the backend identifier (e.g. "git", "hg", "fossil", "jj"). Push pushes the updated ref (if non-empty) and tags to remote. An empty remote uses the backend’s default remote. PushHint returns a human-readable command hint for publishing res to remote when -push was not passed. ReadFile returns the contents of a VCS-tracked file at rev. ResolveRev resolves a revision expression. An empty rev resolves the backend’s current working revision (e.g. HEAD in Git, "." in Mercurial, "@" in Jujutsu, "current" in Fossil). Root returns the repository root identifier (typically an absolute path). Tags returns all tags currently present in the repository. *go.pact.im/x/goship/internal/vcs/fossilvcs.Repo *go.pact.im/x/goship/internal/vcs/gitvcs.Repo *go.pact.im/x/goship/internal/vcs/hgvcs.Repo *go.pact.im/x/goship/internal/vcs/jjvcs.Repo *go.pact.im/x/goship/internal/vcs/memvcs.Repo func (*Registry).Open(ctx context.Context, name, dir string) (VCS, error) func go.pact.im/x/goship/internal/vcs/fossilvcs.Open(ctx context.Context, dir string, cfg fossilvcs.Config) (VCS, error) func go.pact.im/x/goship/internal/vcs/gitvcs.Open(ctx context.Context, dir string, cfg gitvcs.Config) (VCS, error) func go.pact.im/x/goship/internal/vcs/hgvcs.Open(ctx context.Context, dir string, cfg hgvcs.Config) (VCS, error) func go.pact.im/x/goship/internal/vcs/jjvcs.Open(ctx context.Context, dir string, cfg jjvcs.Config) (VCS, error) func go.pact.im/x/goship/internal/apidiff.Compare(ctx context.Context, v VCS, oldRev, newRev, modDir string, workspaceDirs []string) (apidiff.ModuleDiff, error) func go.pact.im/x/goship/internal/apidiff.CompareBatch(ctx context.Context, v VCS, newRev string, reqs []apidiff.ModuleRequest, workspaceDirs []string) (map[string]apidiff.ModuleDiff, error) func go.pact.im/x/goship/internal/workspace.(*AutoLoader).Load(ctx context.Context, v VCS, rev string) ([]*modgraph.Module, error) func go.pact.im/x/goship/internal/workspace.Loader.Load(ctx context.Context, v VCS, rev string) ([]*modgraph.Module, error) func go.pact.im/x/goship/internal/workspace.(*WalkLoader).Load(ctx context.Context, v VCS, rev string) ([]*modgraph.Module, error) func go.pact.im/x/goship/internal/workspace.(*WorkLoader).Load(ctx context.Context, v VCS, rev string) ([]*modgraph.Module, error)
Package-Level Functions (total 7, all are exported)
CleanRelDir normalizes a repo-relative directory path, returning "" for the repository root ("." or "").
CleanRelPath normalizes a repo-relative path to a clean slash-separated form without a leading "./".
DirPrefix returns a trailing-slash prefix for dir, or "" for the repo root.
ExtractTar extracts regular files from a tar stream into destDir using os.Root to prevent path traversal. If stripPrefix is non-empty, that leading slash-terminated prefix is stripped from each entry name. ExtractTar always drains trailing padding from r so streaming producers do not block on pipes.
NewRegistry creates a Registry with the given VCS backends in priority order.
RunCmd executes an external VCS command in dir with optional stdin and extra environment variables, returning stdout bytes or a stderr-enriched error.
WriteDirFile safely writes data to slashPath within rootDir using os.Root to prevent path traversal outside the session working tree.
Package-Level Constants (only one, which is exported)
BackendAuto selects automatic VCS backend detection.