types

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitsBranch

type CommitsBranch struct {
	Prefix         string
	CommitHashFrom string
	CommitHashTo   string
}

CommitsBranch represents a local base branch

This contains patches for CommitHashFrom..CommitHashTo

func (CommitsBranch) Apply

Apply applies contents(diff or patch) of this ghost branch on passed working env

func (CommitsBranch) BranchName

func (b CommitsBranch) BranchName() string

BranchName returns its full branch name on git repository

func (CommitsBranch) FileName

func (b CommitsBranch) FileName() string

FileName returns a file name containing this GhostBranch

func (CommitsBranch) Show

func (bs CommitsBranch) Show(we WorkingEnv, writer io.Writer) errors.GitGhostError

Show writes contents of this ghost branch on passed working env to writer

type CommitsBranchSpec

type CommitsBranchSpec struct {
	Prefix         string
	CommittishFrom string
	CommittishTo   string
}

CommitsBranchSpec is a spec for creating local base branch

func (CommitsBranchSpec) CreateBranch

CreateBranch create a ghost branch on WorkingEnv and returns a GhostBranch object

func (CommitsBranchSpec) PullBranch

PullBranch pulls a ghost branch on from ghost repo in WorkingEnv and returns a GhostBranch object

func (CommitsBranchSpec) Resolve

Resolve resolves committish in DiffBranchSpec as full commit hash values

type CommitsBranches

type CommitsBranches []CommitsBranch

CommitsBranches is an alias for []CommitsBranch

func (CommitsBranches) AsGhostBranches

func (branches CommitsBranches) AsGhostBranches() []GhostBranch

AsGhostBranches just lifts item type to GhostBranch

func (CommitsBranches) Sort

func (branches CommitsBranches) Sort()

Sort sorts passed branches in lexicographic order of BranchName()

type DiffBranch

type DiffBranch struct {
	// Prefix is a prefix of branch name
	Prefix string
	// CommitHashFrom is full commit hash to which this local mod branch's diff contains
	CommitHashFrom string
	// DiffHash is a hash value of its diff
	DiffHash string
}

DiffBranch represents a local mod branch

This contains diff - whose content hash value is DiffHash - which is generated on CommitHashFrom

func (DiffBranch) Apply

Apply applies contents(diff or patch) of this ghost branch on passed working env

func (DiffBranch) BranchName

func (b DiffBranch) BranchName() string

BranchName returns its full branch name on git repository

func (DiffBranch) FileName

func (b DiffBranch) FileName() string

FileName returns a file name containing this GhostBranch

func (DiffBranch) Show

func (bs DiffBranch) Show(we WorkingEnv, writer io.Writer) errors.GitGhostError

Show writes contents of this ghost branch on passed working env to writer

type DiffBranchSpec

type DiffBranchSpec struct {
	Prefix            string
	CommittishFrom    string
	IncludedFilepaths []string
	FollowSymlinks    bool
}

DiffBranchSpec is a spec for creating local mod branch

func (DiffBranchSpec) CreateBranch

func (bs DiffBranchSpec) CreateBranch(we WorkingEnv) (GhostBranch, errors.GitGhostError)

CreateBranch create a ghost branch on WorkingEnv and returns a GhostBranch object

func (DiffBranchSpec) Resolve

func (bs DiffBranchSpec) Resolve(srcDir string) (*DiffBranchSpec, errors.GitGhostError)

Resolve resolves committish in DiffBranchSpec as full commit hash values

type DiffBranches

type DiffBranches []DiffBranch

DiffBranches is an alias for []DiffBranch

func (DiffBranches) AsGhostBranches

func (branches DiffBranches) AsGhostBranches() []GhostBranch

AsGhostBranches just lifts item type to GhostBranch

func (DiffBranches) Sort

func (branches DiffBranches) Sort()

Sort sorts passed branches in lexicographic order of BranchName()

type GhostBranch

type GhostBranch interface {
	// BranchName returns its full branch name on git repository
	BranchName() string
	// FileName returns a file name contained in the GhostBranch
	FileName() string
	// Show writes contents of this ghost branch on passed working env to writer
	Show(we WorkingEnv, writer io.Writer) errors.GitGhostError
	// Apply applies contents(diff or patch) of this ghost branch on passed working env
	Apply(we WorkingEnv) errors.GitGhostError
}

GhostBranch is an interface representing a ghost branch.

It is created from GhostBranchSpec/PullableGhostBranchSpec

func CreateGhostBranchByName

func CreateGhostBranchByName(branchName string) GhostBranch

CreateGhostBranchByName instantiates GhostBranch object from branchname

type GhostBranchSpec

type GhostBranchSpec interface {
	// CreateBranch create a ghost branch on WorkingEnv and returns a GhostBranch object
	CreateBranch(we WorkingEnv) (GhostBranch, errors.GitGhostError)
}

GhostBranchSpec is an interface

GhostBranchSpec is a specification for creating ghost branch

type ListCommitsBranchSpec

type ListCommitsBranchSpec struct {
	// Prefix is a prefix of branch name
	Prefix string
	// HashFrom is committish value to list HashFrom..HashTo
	HashFrom string
	// HashTo is a committish value to list HashFrom..HashTo
	HashTo string
}

ListCommitsBranchSpec is spec for list commits branch

func (*ListCommitsBranchSpec) GetBranches

GetBranches returns CommitsBranches from spec

func (*ListCommitsBranchSpec) Resolve

func (ls *ListCommitsBranchSpec) Resolve(srcDir string) *ListCommitsBranchSpec

Resolve resolves committish values in ListCommitsBranchSpec as full commit hash

type ListDiffBranchSpec

type ListDiffBranchSpec struct {
	Prefix string
	// HashFrom is committish value to list HashFrom..HashTo
	HashFrom string
	// HashTo is a committish value to list HashFrom..HashTo
	HashTo string
}

ListCommitsBranchSpec is spec for list diff branch

func (*ListDiffBranchSpec) GetBranches

func (ls *ListDiffBranchSpec) GetBranches(repo string) (DiffBranches, errors.GitGhostError)

GetBranches returns DiffBranches from spec

func (*ListDiffBranchSpec) Resolve

func (ls *ListDiffBranchSpec) Resolve(srcDir string) *ListDiffBranchSpec

Resolve resolves committish values in ListDiffBranchSpec as full commit hash

type PullableDiffBranchSpec

type PullableDiffBranchSpec struct {
	Prefix         string
	CommittishFrom string
	DiffHash       string
}

PullableDiffBranchSpec is a spec for pulling local base branch

func (PullableDiffBranchSpec) PullBranch

PullBranch pulls a ghost branch on from ghost repo in WorkingEnv and returns a GhostBranch object

func (PullableDiffBranchSpec) Resolve

Resolve resolves committish in PullableDiffBranchSpec as full commit hash values

type PullableGhostBranchSpec

type PullableGhostBranchSpec interface {
	// PullBranch pulls a ghost branch on from ghost repo in WorkingEnv and returns a GhostBranch object
	PullBranch(we WorkingEnv) (GhostBranch, errors.GitGhostError)
}

PullableGhostBranchSpec is an interface

PullableGhostBranchSpec is a specification for pulling ghost branch from ghost repo

type WorkingEnv

type WorkingEnv struct {
	WorkingEnvSpec
	GhostDir string
}

WorkingEnv is initialized environment containing temporary local ghost repository

func (WorkingEnv) Clean

func (weSpec WorkingEnv) Clean() errors.GitGhostError

type WorkingEnvSpec

type WorkingEnvSpec struct {
	// SrcDir is local git directory
	SrcDir string
	// GhostWorkingDir is a root directory which git-ghost creates temporary directories
	GhostWorkingDir string
	// GhostRepo is a repository url git-ghost works with
	GhostRepo string
	// GhostUserName is a user name which is used in ghost working directories.
	GhostUserName string
	// GhostUserEmail is a user email which is used in ghost working directories.
	GhostUserEmail string
}

WorkingEnvSpec abstract an environment git-ghost works with

func (WorkingEnvSpec) Initialize

func (weSpec WorkingEnvSpec) Initialize() (*WorkingEnv, errors.GitGhostError)

Jump to

Keyboard shortcuts

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