gitx

package
v0.0.0-...-9c55465 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostGitHub  = "github"
	HostGitlab  = "gitlab"
	HostDefault = "git"
)
View Source
const (
	GitHubHost = "github.com"
	GitHubURL  = "https://github.com"

	DefaultSrcRemote = "main"
	DefaultOriRemote = "origin"
)

Variables

This section is empty.

Functions

func BatchPull

func BatchPull()

Types

type Config

type Config struct {
	// GitUrl ssh git host url
	GitUrl string `json:"git_url"`
	// HostUrl http host url. eg: https://gitlab.myself.com
	HostUrl string `json:"host_url"`
	// HostType eg: HostGitHub
	HostType string `json:"host_type"`
	// AutoSign auto add author sign on commit
	AutoSign bool `json:"auto_sign"`
	// ForkMode enable git fork mode for develop.
	// If is False, use branch mode, will ignore SourceRemote setting.
	ForkMode bool `json:"fork_mode"`
	// SourceRemote the source remote name, it is center repo.
	SourceRemote string `json:"source_remote"`
	// DefaultRemote the default upstream remote name, use for develop. default: origin.
	// It should be forked from SourceRemote.
	DefaultRemote string `json:"default_remote"`
	// DefaultBranch name, default is gitw.DefaultBranchName
	DefaultBranch string `json:"default_branch"`
	// BranchAliases branch aliases
	BranchAliases maputil.Aliases `json:"branch_aliases"`
}

Config for gitx

func NewConfig

func NewConfig() *Config

NewConfig instance

func (*Config) BuildRepoURL

func (c *Config) BuildRepoURL(repoPath string, useSsh bool) string

BuildRepoURL build

func (*Config) Clone

func (c *Config) Clone() *Config

Clone new config instance

func (*Config) Init

func (c *Config) Init() *Config

Init config.

func (*Config) IsCenterRemote

func (c *Config) IsCenterRemote(remote string) bool

func (*Config) IsDefaultRemote

func (c *Config) IsDefaultRemote(remote string) bool

func (*Config) IsForkMode

func (c *Config) IsForkMode() bool

IsForkMode check

func (*Config) IsSourceRemote

func (c *Config) IsSourceRemote(remote string) bool

func (*Config) LoadRepo

func (c *Config) LoadRepo(repoDir string) *GitLoc

LoadRepo by given git repo dir.

func (*Config) OriginBranch

func (c *Config) OriginBranch(br string) string

OriginBranch name build

func (*Config) ResolveAlias

func (c *Config) ResolveAlias(name string) string

ResolveAlias branch name

func (*Config) ResolveBranch

func (c *Config) ResolveBranch(name string) string

ResolveBranch branch name

func (*Config) SourceBranch

func (c *Config) SourceBranch(br string) string

SourceBranch name build

type ConfigProviderFn

type ConfigProviderFn func() *Config

ConfigProviderFn type

type GitBatchRun

type GitBatchRun struct {
}

GitBatchRun struct

func NewBatchRun

func NewBatchRun(fn ...func(gbr *GitBatchRun)) *GitBatchRun

type GitLoc

type GitLoc struct {
	*Config
	// local repo
	*gitw.Repo
}

GitLoc repo struct

func NewGitLoc

func NewGitLoc(repoDir string, cfg *Config) *GitLoc

NewGitLoc instance

func (*GitLoc) Check

func (g *GitLoc) Check() error

Check git config.

func (*GitLoc) CheckRemote

func (g *GitLoc) CheckRemote() error

CheckRemote git config.

func (*GitLoc) DefRemoteInfo

func (g *GitLoc) DefRemoteInfo() *gitw.RemoteInfo

DefRemoteInfo data.

func (*GitLoc) FetchOrigin

func (g *GitLoc) FetchOrigin() error

FetchOrigin fetch default remote

func (*GitLoc) FetchSource

func (g *GitLoc) FetchSource() error

FetchSource fetch source remote

func (*GitLoc) HasDefaultBranch

func (g *GitLoc) HasDefaultBranch(br string) bool

HasDefaultBranch check

func (*GitLoc) HasDefaultRemote

func (g *GitLoc) HasDefaultRemote() bool

func (*GitLoc) HasOriginBranch

func (g *GitLoc) HasOriginBranch(br string) bool

HasOriginBranch check

func (*GitLoc) HasSourceBranch

func (g *GitLoc) HasSourceBranch(br string) bool

HasSourceBranch check

func (*GitLoc) HasSourceRemote

func (g *GitLoc) HasSourceRemote() bool

func (*GitLoc) RepoDir

func (g *GitLoc) RepoDir() string

RepoDir path.

func (*GitLoc) SrcRemoteInfo

func (g *GitLoc) SrcRemoteInfo() *gitw.RemoteInfo

SrcRemoteInfo data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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