api

package
v0.0.0-...-ba4a4a7 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MoreNone                    = 0
	MoreMergeIn   utils.Bitmask = 1 << iota // ╮
	MoreBranchOut                           // ╭
)
View Source
const (
	BBlank                   = 0         //
	BCommit    utils.Bitmask = 1 << iota // ┣
	BLine                                // ┃
	BTip                                 // ┏
	BBottom                              // ┗
	BActiveTip                           // ┣

	// Connections
	Pass           // ─ or ╂ for branch positions
	MergeFromLeft  // ╭
	MergeFromRight // ╮
	BranchToLeft   // ╰
	BranchToRight  // ╯
	ConnectLine    // │
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AmbiguousBranchBranchesReq

type AmbiguousBranchBranchesReq struct {
	RepoID   string
	CommitID string
}

type Api

type Api interface {
	GetRecentWorkingDirs() ([]string, error)
	GetSubDirs(dirPath string) ([]string, error)

	OpenRepo(path string) async.Task[string]
	CloneRepo(uri, path string) async.Task[any]
	CloseRepo(repoID string) error

	GetRepoChanges(repoID string) ([]RepoChange, error)
	TriggerRefreshRepo(repoID string) error
	TriggerSearch(search Search) error

	GetBranches(args GetBranchesReq) ([]Branch, error)
	GetFiles(args FilesReq) ([]string, error)
	GetCommitDiff(info CommitDiffInfoReq) (CommitDiff, error)
	GetFileDiff(info FileDiffInfoReq) ([]CommitDiff, error)
	GetCommitDetails(req CommitDetailsReq) (CommitDetailsRsp, error)
	GetAmbiguousBranchBranches(args AmbiguousBranchBranchesReq) ([]Branch, error)

	Commit(info CommitInfoReq) error
	UndoCommit(repoID, id string) error
	UndoUncommittedFileChanges(repoID, path string) error
	UncommitLastCommit(repoID string) error
	UndoAllUncommittedChanges(repoID string) error
	CleanWorkingFolder(repoID string) error

	ShowBranch(name BranchName) error
	HideBranch(name BranchName) error

	Checkout(repoId, name, displayName string) error
	PushBranch(repoID, branchName string) error
	PullCurrentBranch(repoID string) error
	PullBranch(name BranchName) error
	MergeBranch(name BranchName) error
	MergeSquashBranch(repoID, branchName string) error
	CreateBranch(name BranchName) error
	DeleteBranch(repoID, branchName string, isForced bool) error
	SetAsParentBranch(req SetParentReq) error
	UnsetAsParentBranch(name BranchName) error
}

type Branch

type Branch struct {
	Name                 string
	DisplayName          string
	Index                int
	IsAmbiguousBranch    bool
	RemoteName           string
	LocalName            string
	IsRemote             bool
	IsGitBranch          bool
	IsCurrent            bool
	IsSetAsParent        bool
	IsMainBranch         bool
	TipID                string
	HasLocalOnly         bool
	HasRemoteOnly        bool
	Color                Color
	X                    int
	AmbiguousTipId       string
	AmbiguousBranchNames []string

	IsShown bool
	IsIn    bool
	IsOut   bool
}

type BranchName

type BranchName struct {
	RepoID     string
	BranchName string
	ParentName string
}

type Branches

type Branches []Branch

func (Branches) Contains

func (bs Branches) Contains(predicate func(b Branch) bool) bool

type Color

type Color int

type Commit

type Commit struct {
	ID                 string
	SID                string
	Subject            string
	Message            string
	Author             string
	AuthorTime         time.Time
	IsCurrent          bool
	BranchIndex        int
	Tags               []string
	More               utils.Bitmask
	ParentIDs          []string
	ChildIDs           []string
	BranchTips         []string
	IsLocalOnly        bool
	IsRemoteOnly       bool
	IsUncommitted      bool
	IsPartialLogCommit bool
	IsAmbiguous        bool
	IsAmbiguousTip     bool
}

type CommitDetailsReq

type CommitDetailsReq struct {
	RepoID   string
	CommitID string
}

type CommitDetailsRsp

type CommitDetailsRsp struct {
	Id          string
	BranchName  string
	BranchColor Color
	Message     string
	Files       []string
}

type CommitDiff

type CommitDiff struct {
	Id        string
	Author    string
	Date      string
	Message   string
	FileDiffs []FileDiff
}

type CommitDiffInfoReq

type CommitDiffInfoReq struct {
	RepoID   string
	CommitID string
}

type CommitInfoReq

type CommitInfoReq struct {
	RepoID  string
	Message string
}

type DiffMode

type DiffMode int
const (
	DiffModified DiffMode = iota
	DiffAdded
	DiffRemoved
	DiffSame
	DiffConflicts
	DiffConflictStart
	DiffConflictSplit
	DiffConflictEnd
)

type FileDiff

type FileDiff struct {
	PathBefore   string
	PathAfter    string
	IsRenamed    bool
	DiffMode     DiffMode
	SectionDiffs []SectionDiff
}

type FileDiffInfoReq

type FileDiffInfoReq struct {
	RepoID string
	Path   string
}

type FilesReq

type FilesReq struct {
	RepoID string
	Ref    string
}

type GetBranchesReq

type GetBranchesReq struct {
	RepoID                    string
	IncludeOnlyCurrent        bool
	IncludeOnlyGitBranches    bool
	IncludeOnlyCommitBranches string
	IncludeOnlyShown          bool
	IncludeOnlyNotShown       bool
	SkipMaster                bool
	SortOnLatest              bool
}

type Graph

type Graph []GraphRow

type GraphColumn

type GraphColumn struct {
	Connect      utils.Bitmask
	Branch       utils.Bitmask
	BranchColor  Color
	ConnectColor Color
	PassColor    Color
}

type GraphRow

type GraphRow []GraphColumn

type LinesDiff

type LinesDiff struct {
	DiffMode DiffMode
	Line     string
}

type Repo

type Repo struct {
	Commits            []Commit
	Branches           []Branch
	CurrentBranchName  string
	RepoPath           string
	UncommittedChanges int
	MergeMessage       string
	Conflicts          int
	ConsoleGraph       Graph
}

type RepoChange

type RepoChange struct {
	IsStarting bool
	ViewRepo   Repo
	SearchText string
	Error      error
}
type Search struct {
	RepoID string
	Text   string
}

type SectionDiff

type SectionDiff struct {
	ChangedIndexes string
	LeftLine       int
	LeftCount      int
	RightLine      int
	RightCount     int
	LinesDiffs     []LinesDiff
}

type SetParentReq

type SetParentReq struct {
	RepoID     string
	BranchName string
	ParentName string
}

Jump to

Keyboard shortcuts

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