Documentation
¶
Overview ¶
Package branch provides branch management types and services.
Index ¶
- type BranchDeleteResult
- type BranchInfo
- type CleanupInput
- type CleanupPlan
- type CleanupResult
- type ListInput
- type ListOutput
- type OrphanedBranch
- type RepositoryBranches
- type Service
- func (s *Service) BuildWorkspaceMapping() (WorkspaceBranchMapping, error)
- func (s *Service) CheckUnpushed(repoPath, branchName string) (hasUnpushed bool, count int, err error)
- func (s *Service) DeleteBranch(repoPath, branchName string) error
- func (s *Service) ExecuteCleanup(plan CleanupPlan, skipBranches []string) (CleanupResult, error)
- func (s *Service) List() (ListOutput, error)
- func (s *Service) PlanCleanup() (CleanupPlan, error)
- type WorkspaceBranchMapping
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BranchDeleteResult ¶
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 ¶
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 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 ¶
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 ¶
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 in parallel. 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 ¶
WorkspaceBranchMapping maps repo:branch to workspace name.