vcs

package
v1.9.29 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package vcs defines a version control system abstraction layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Type() Type

	// RepoDir returns the root directory of the repository.
	RepoDir() string

	// Branch operations
	BranchExists(branchName string) bool
	GetCurrentBranch() (string, error)
	GetDefaultBranch() (string, error)
	DeleteBranch(branchName string, force bool) error
	MergeBranch(branchName string) error

	// Worktree operations
	WorktreePath(opts WorktreePathOptions) string
	CreateWorktree(worktreePath, branchName string) error
	ListWorktrees() ([]Worktree, error)
	RemoveWorktree(worktreePath string, force bool) error
	GetWorktreeForBranch(branchName string) (string, error)
	PruneWorktrees() error
}

Backend abstracts version control operations scoped to a repository.

type Type

type Type string
const (
	TypeGit     Type = "git"
	TypeJujutsu Type = "jujutsu"
)

type Worktree

type Worktree struct {
	Path   string // Filesystem path to the worktree
	Branch string // Branch name checked out in this worktree
	Commit string // HEAD commit SHA
	Bare   bool   // Whether this is the bare repository
}

Worktree represents a VCS worktree.

type WorktreePathOptions

type WorktreePathOptions struct {
	Branch    string
	Location  string
	SessionID string
	Template  string
}

WorktreePathOptions configures worktree path generation for a Backend. Unlike git.WorktreePathOptions, it omits RepoDir because the backend supplies it.

Jump to

Keyboard shortcuts

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