branch

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package branch provides branch management types and services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchDeleteResult

type BranchDeleteResult struct {
	RepoName   string
	BranchName string
	Reason     string
	Error      error
}

BranchDeleteResult describes outcome of deleting a single branch.

type BranchInfo

type BranchInfo struct {
	Name           string
	RepoName       string
	RepoPath       string
	IsDefault      bool
	WorkspaceName  string
	IsOrphaned     bool
	IsIgnored      bool
	HasUnpushed    bool
	UnpushedCount  int
	LastCommitTime string
	LastCommitBy   string
}

BranchInfo contains comprehensive information about a branch.

type CleanupInput

type CleanupInput struct {
	ReposDir       string
	IgnorePatterns []string
}

CleanupInput contains parameters for cleanup operation.

type CleanupPlan

type CleanupPlan struct {
	OrphanedBranches []OrphanedBranch
	SkippedIgnored   int
}

CleanupPlan describes what branches will be cleaned up.

type CleanupResult

type CleanupResult struct {
	Deleted []BranchDeleteResult
	Skipped []BranchDeleteResult
	Failed  []BranchDeleteResult
}

CleanupResult contains the outcome of cleanup operation.

type ListInput

type ListInput struct {
	ReposDir       string
	WorkspacesDir  string
	IgnorePatterns []string
}

ListInput contains parameters for listing branches.

type ListOutput

type ListOutput struct {
	Repositories  []RepositoryBranches
	TotalBranches int
	OrphanedCount int
	IgnoredCount  int
}

ListOutput contains the result of listing branches.

type OrphanedBranch

type OrphanedBranch struct {
	RepoName      string
	RepoPath      string
	BranchName    string
	HasUnpushed   bool
	UnpushedCount int
}

OrphanedBranch is a branch that can be cleaned up.

type RepositoryBranches

type RepositoryBranches struct {
	RepoName      string
	RepoPath      string
	DefaultBranch string
	Branches      []BranchInfo
}

RepositoryBranches groups branches by repository.

type Service

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

Service provides branch management operations.

func NewService

func NewService(wm *workspace.Manager, ignorePatterns []string) *Service

NewService creates a new branch service.

func (*Service) BuildWorkspaceMapping

func (s *Service) BuildWorkspaceMapping() (WorkspaceBranchMapping, error)

BuildWorkspaceMapping creates a map of repo:branch -> workspace name.

func (*Service) CheckUnpushed

func (s *Service) CheckUnpushed(repoPath, branchName string) (hasUnpushed bool, count int, err error)

CheckUnpushed checks if a branch has unpushed commits.

func (*Service) DeleteBranch

func (s *Service) DeleteBranch(repoPath, branchName string) error

DeleteBranch deletes a single branch from a repository.

func (*Service) ExecuteCleanup

func (s *Service) ExecuteCleanup(plan *CleanupPlan, skipBranches []string) (*CleanupResult, error)

ExecuteCleanup deletes the specified orphaned branches. skipBranches contains branch names to skip (format: "repo:branch").

func (*Service) List

func (s *Service) List() (*ListOutput, error)

List returns all branches across repositories with workspace mapping.

func (*Service) PlanCleanup

func (s *Service) PlanCleanup() (*CleanupPlan, error)

PlanCleanup identifies orphaned branches for cleanup.

type WorkspaceBranchMapping

type WorkspaceBranchMapping map[string]string

WorkspaceBranchMapping maps repo:branch to workspace name.

Jump to

Keyboard shortcuts

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