config

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package config provides global variables, macros, environments and settings.

Index

Constants

View Source
const (
	GIT = "git"

	DefaultConfigDir = ".git-repo"
	DefaultLogRotate = 20 * 1024 * 1024
	DefaultLogLevel  = "warn"

	CfgRepoArchive           = "repo.archive"
	CfgRepoDepth             = "repo.depth"
	CfgRepoDissociate        = "repo.dissociate"
	CfgRepoMirror            = "repo.mirror"
	CfgRepoReference         = "repo.reference"
	CfgRepoSubmodules        = "repo.submodules"
	CfgManifestGroups        = "manifest.groups"
	CfgManifestName          = "manifest.name"
	CfgRemoteOriginURL       = "remote.origin.url"
	CfgBranchDefaultMerge    = "branch.default.merge"
	CfgManifestRemoteSSHInfo = "manifest.remote.%s.sshinfo"
	CfgManifestRemoteExpire  = "manifest.remote.%s.expire"
	CfgAppGitRepoDisabled    = "app.git.repo.disabled"

	ManifestsDotGit  = "manifests.git"
	Manifests        = "manifests"
	DefaultXML       = "default.xml"
	ManifestXML      = "manifest.xml"
	LocalManifestXML = "local_manifest.xml"
	LocalManifests   = "local_manifests"
	ProjectObjects   = "project-objects"
	Projects         = "projects"

	RefsHeads   = "refs/heads/"
	RefsTags    = "refs/tags/"
	RefsPub     = "refs/published/"
	Refs        = "refs/"
	RefsRemotes = "refs/remotes/"

	MaxJobs = 32

	ViperEnvPrefix = "GIT_REPO"
)

Exported macros

View Source
const (
	// DefaultGitRepoConfigFile is default git-repo config file
	DefaultGitRepoConfigFile = "config"
)

Variables

View Source
var (
	// DotRepo is '.repo', admin directory for git-repo
	DotRepo = path.DotRepo

	// CommitIDPattern indicates raw commit ID
	CommitIDPattern = regexp.MustCompile(`^[0-9a-f]{40}([0-9a-f]{24})?$`)

	// GitDefaultConfig is git global and system config.
	GitDefaultConfig goconfig.GitConfig
)
View Source
var (
	// GitHTTPProtocolPattern indicates git over HTTP protocol
	GitHTTPProtocolPattern = regexp.MustCompile(`^(?P<proto>http|https)://((?P<user>.*?)@)?(?P<host>[^/]+?)(:(?P<port>[0-9]+))?(/(?P<repo>.*?)(\.git)?/?)?$`)
	// GitSSHProtocolPattern indicates git over SSH protocol
	GitSSHProtocolPattern = regexp.MustCompile(`^(?P<proto>ssh)://((?P<user>.*?)@)?(?P<host>[^/]+?)(:(?P<port>[0-9]+))?(/(?P<repo>.+?)(\.git)?)?/?$`)
	// GitSCPProtocolPattern indicates scp-style git over SSH protocol
	GitSCPProtocolPattern = regexp.MustCompile(`^((?P<user>.*?)@)?(?P<host>[^/:]+?):(?P<repo>.*?)(\.git)?/?$`)
	// GitDaemonProtocolPattern indicates git over git-daemon protocol
	GitDaemonProtocolPattern = regexp.MustCompile(`^(?P<proto>git)://(?P<host>[^/]+?)(:(?P<port>[0-9]+))?(/(?P<repo>.*?)(\.git)?/?)?$`)
	// GitFileProtocolPattern indicates git over file protocol
	GitFileProtocolPattern = regexp.MustCompile(`^(?:(?P<proto>file)://)?(/(?P<repo>.*?)/?)?$`)
)
View Source
var (
	// GerritHooks defines map of Gerrit hooks.
	GerritHooks = map[string]string{
		"commit-msg": gerritCommitMsgHook,
	}
)
View Source
var (

	// PGPKeyRing for verify git-repo package
	PGPKeyRing = map[string]string{
		"Jiang Xin": pubkey1,
		"Alibaba":   pubkey2,
	}
)

Functions

func AssumeNo

func AssumeNo() bool

AssumeNo gets --asume-no option.

func AssumeYes

func AssumeYes() bool

AssumeYes gets --asume-yes option.

func CheckGitAlias

func CheckGitAlias()

CheckGitAlias checks if any alias command has been overridden.

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns ~/.git-repo dir

func GetLogFile

func GetLogFile() string

GetLogFile gets --logfile option.

func GetLogLevel

func GetLogLevel() string

GetLogLevel gets --loglevel option.

func GetLogRotateSize

func GetLogRotateSize() int64

GetLogRotateSize gets logrotate size from config.

func GetMockSSHInfoResponse

func GetMockSSHInfoResponse() string

GetMockSSHInfoResponse gets --mock-ssh-info-response option.

func GetMockSSHInfoStatus

func GetMockSSHInfoStatus() int

GetMockSSHInfoStatus gets --mock-ssh-info-status option.

func GetQuiet

func GetQuiet() bool

GetQuiet gets --quiet option.

func GetRepoHooksDir

func GetRepoHooksDir() (string, error)

GetRepoHooksDir returns the hooks template dir for git-repo.

func GetVerbose

func GetVerbose() int

GetVerbose gets --verbose option.

func InstallExtraGitConfig

func InstallExtraGitConfig() error

InstallExtraGitConfig installs extra git config file if necessary.

func InstallRepoConfig

func InstallRepoConfig() error

InstallRepoConfig installs default git-repo config example file.

func InstallRepoHooks

func InstallRepoHooks() error

InstallRepoHooks installs hooks into ~/.git-repo/hooks.

func IsDryRun

func IsDryRun() bool

IsDryRun gets --dryrun option.

func IsSingleMode

func IsSingleMode() bool

IsSingleMode gets --single option.

func MockNoSymlink() bool

MockNoSymlink checks --mock-no-symlink option.

func MockNoTTY

func MockNoTTY() bool

MockNoTTY checks --mock-no-tty option.

func MockUploadOptionsEditScript

func MockUploadOptionsEditScript() string

MockUploadOptionsEditScript gets --mock-upload-options-edit-script option.

func NoCertChecks

func NoCertChecks() bool

NoCertChecks indicates whether ignore ssl cert.

Types

type CodeReview added in v0.7.7

type CodeReview struct {
	ID  string
	Ref string
}

CodeReview to be updated.

func (CodeReview) Empty added in v0.7.7

func (v CodeReview) Empty() bool

Empty checks if CodeReview is empty.

type GitURL

type GitURL struct {
	Proto string
	User  string
	Host  string
	Port  int
	Repo  string
}

GitURL holds Git URL.

func ParseGitURL

func ParseGitURL(address string) *GitURL

ParseGitURL parses address and returns GitURL.

func (GitURL) GetRootURL

func (v GitURL) GetRootURL() string

GetRootURL returns root URL, can be used for review.

func (GitURL) IsHTTP

func (v GitURL) IsHTTP() bool

IsHTTP indicates whether protocol is HTTP/HTTPS.

func (GitURL) IsLocal

func (v GitURL) IsLocal() bool

IsLocal indicates whether protocol is local path.

func (GitURL) IsSSH

func (v GitURL) IsSSH() bool

IsSSH indicates whether protocol is SSH.

func (GitURL) String

func (v GitURL) String() string

String returns full URL

func (GitURL) UserHost

func (v GitURL) UserHost() string

UserHost returns user@hostname.

type UploadOptions added in v0.7.7

type UploadOptions struct {
	AutoTopic    bool
	CodeReview   CodeReview // Directly edit remote code review.
	Description  string
	DestBranch   string // Target branch for code review.
	Draft        bool
	Issue        string
	LocalBranch  string // Local branch with commits, will push to remote.
	MockGitPush  bool
	NoCertChecks bool
	NoEmails     bool
	OldOid       string
	People       [][]string
	Private      bool
	PushOptions  []string
	RemoteName   string
	RemoteURL    string
	Title        string
	WIP          bool
}

UploadOptions is options for upload related methods.

Jump to

Keyboard shortcuts

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