Documentation ¶
Overview ¶
Package gitget implements business logic of the application.
Index ¶
- func DecomposeGitURL(gitURL string) (string, string, string)
- func GenerateGitfileConfig(cfgFile string, ignoreFiles []string, gitCloudProviderRootURL string, ...)
- func GetRepositories(cfgFiles []string, ignoreFiles []string, concurrencyLevel int, stickToRef bool, ...)
- func MirrorRepositories(cfgFiles []string, ignoreFiles []string, concurrencyLevel int, pushMirror bool, ...)
- func PathExists(path string) (bool, os.FileInfo)
- type ConfigGenParamsStruct
- type Repo
- func (repo *Repo) ChoosePathPrefix(pathPrefix string) string
- func (repo *Repo) Clone() bool
- func (repo *Repo) CloneMirror() bool
- func (repo *Repo) CreateSymlink(symlink string)
- func (repo *Repo) EnsureBitbucketMirrorExists()
- func (repo *Repo) EnsureGithubMirrorExists()
- func (repo *Repo) EnsureGitlabMirrorExists()
- func (repo *Repo) EnsureMirrorExists()
- func (repo *Repo) EnsurePathExists(pathPrefix string)
- func (repo *Repo) GetCurrentBranch() string
- func (repo *Repo) GetRepoLocalName() string
- func (repo *Repo) GitCheckout(branch string) bool
- func (repo *Repo) GitPull()
- func (repo *Repo) GitStashPop() bool
- func (repo *Repo) GitStashSave() bool
- func (repo *Repo) IsClean() bool
- func (repo *Repo) IsCurrentBranchRef() bool
- func (repo *Repo) IsRefBranch() bool
- func (repo *Repo) IsRefTag() bool
- func (repo *Repo) PrepareForGet()
- func (repo *Repo) PrepareForMirror(pathPrefix string, mirrorRootURL string)
- func (repo *Repo) ProcessRepoBasedOnCleaness()
- func (repo *Repo) ProcessRepoBasedOnCurrentBranch()
- func (repo *Repo) ProcessSymlinks()
- func (repo *Repo) PushMirror() bool
- func (repo *Repo) RemoveTargetDir(dotGit bool)
- func (repo *Repo) RepoPathExists() bool
- func (repo *Repo) SetDefaultRef()
- func (repo *Repo) SetMirrorURL(mirrorRootURL string)
- func (repo *Repo) SetRepoFullPath()
- func (repo *Repo) SetRepoLocalName()
- func (repo *Repo) SetSha()
- func (repo *Repo) SetShellRunner(exe exec.ShellRunnerI)
- func (repo *Repo) SetTempRepoPathForMirror(pathPrefix string)
- func (repo *Repo) ShallowClone() bool
- type RepoI
- type RepoList
- type RepoStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateGitfileConfig ¶
func GenerateGitfileConfig( cfgFile string, ignoreFiles []string, gitCloudProviderRootURL string, gitCloudProvider string, targetClonePath string, configGenParams ConfigGenParamsStruct, )
GenerateGitfileConfig - Entry point for Gitfile generation logic
func GetRepositories ¶
func GetRepositories( cfgFiles []string, ignoreFiles []string, concurrencyLevel int, stickToRef bool, shallow bool, defaultTrunkBranch string, status bool, )
GetRepositories - gets the list of repositories
func MirrorRepositories ¶
func MirrorRepositories( cfgFiles []string, ignoreFiles []string, concurrencyLevel int, pushMirror bool, mirrorRootURL string, mirrorProviderName string, mirrorVisibilityModeName string, mirrorBitbucketProjectName string, )
MirrorRepositories - Entry point for mirror creation/update logic
Types ¶
type ConfigGenParamsStruct ¶
type ConfigGenParamsStruct struct { // ssh or https in output file GitSchema string // Gitlab specific vars GitlabOwned bool GitlabVisibility string GitlabMinAccessLevel string // GitHub specific vars GithubVisibility string GithubAffiliation string // Bitbucket specific vars /* MAYBE: implement for bitbucket to allow subset of repositories BitbucketDivision string */ BitbucketRole string }
ConfigGenParamsStruct - data structure to store parameters passed via cli flags
type Repo ¶
type Repo struct { URL string `yaml:"url"` // git url of the remote repository Path string `yaml:"path,omitempty"` // to clone repository to AltName string `yaml:"altname,omitempty"` // when cloned, repository will have different name from remote Ref string `yaml:"ref,omitempty"` // branch to clone (normally trunk branch name, but git sha or git tag can be also specified) Symlinks []string `yaml:"symlinks,omitempty"` // paths where to create symlinks to the repository clone // contains filtered or unexported fields }
Repo structure defines information about single git repository.
func GetIgnoreRepoList ¶
GetIgnoreRepoList - tries to read ignore files from the list, if these are existing and returns list of repositories
func (*Repo) ChoosePathPrefix ¶
func (*Repo) CloneMirror ¶
CloneMirror runs `git clone --mirror` command.
func (*Repo) CreateSymlink ¶
func (*Repo) EnsureBitbucketMirrorExists ¶
func (repo *Repo) EnsureBitbucketMirrorExists()
EnsureBitbucketMirrorExists - creates mirror repository if it does not exist
func (*Repo) EnsureGithubMirrorExists ¶
func (repo *Repo) EnsureGithubMirrorExists()
EnsureGithubMirrorExists - creates mirror repository if it does not exist
func (*Repo) EnsureGitlabMirrorExists ¶
func (repo *Repo) EnsureGitlabMirrorExists()
func (*Repo) EnsureMirrorExists ¶
func (repo *Repo) EnsureMirrorExists()
func (*Repo) EnsurePathExists ¶
func (*Repo) GetCurrentBranch ¶
func (*Repo) GetRepoLocalName ¶
func (*Repo) GitCheckout ¶
func (*Repo) GitStashPop ¶
func (*Repo) GitStashSave ¶
func (*Repo) IsCurrentBranchRef ¶
func (*Repo) PrepareForGet ¶
func (repo *Repo) PrepareForGet()
PrepareForGet performs checks for repository as well as constructs extra information and sets repository data structure values.
func (*Repo) PrepareForMirror ¶
PrepareForMirror - set repository structure fields for mirror operation
func (*Repo) ProcessRepoBasedOnCleaness ¶
func (repo *Repo) ProcessRepoBasedOnCleaness()
func (*Repo) ProcessRepoBasedOnCurrentBranch ¶
func (repo *Repo) ProcessRepoBasedOnCurrentBranch()
func (*Repo) ProcessSymlinks ¶
func (repo *Repo) ProcessSymlinks()
func (*Repo) PushMirror ¶
PushMirror runs `git push --mirror` command.
func (*Repo) RemoveTargetDir ¶
func (*Repo) RepoPathExists ¶
func (*Repo) SetDefaultRef ¶
func (repo *Repo) SetDefaultRef()
SetDefaultRef sets in place default name of the ref to master (by default) or user passed via flag if not specified
func (*Repo) SetMirrorURL ¶
func (*Repo) SetRepoFullPath ¶
func (repo *Repo) SetRepoFullPath()
func (*Repo) SetRepoLocalName ¶
func (repo *Repo) SetRepoLocalName()
SetRepoLocalName sets struct AltName to short name obtained from repository uri
func (*Repo) SetSha ¶
func (repo *Repo) SetSha()
SetSha generates and sets `sha` of the data structure to use in log messages.
func (*Repo) SetShellRunner ¶ added in v0.0.14
func (repo *Repo) SetShellRunner(exe exec.ShellRunnerI)
func (*Repo) SetTempRepoPathForMirror ¶
func (*Repo) ShallowClone ¶
ShallowClone runs `git clone --depth 1 --branch` command.
type RepoI ¶
type RepoI interface { Clone() bool CreateSymlink(symlink string) ChoosePathPrefix(pathPrefix string) string EnsurePathExists() GetCurrentBranch() string GetRepoLocalName() string GitCheckout(branch string) bool GitPull() GitStashPop() bool GitStashSave() bool IsClean() bool IsCurrentBranchRef() bool IsRefBranch() bool IsRefTag() bool PathExists(path string) (bool, os.FileInfo) PrepareForGet() PrepareForMirror(pathPrefix string, mirrorRootURL string) ProcessRepoBasedOnCleaness() ProcessRepoBasedOnCurrentBranch() ProcessSymlinks() RepoPathExists() bool SetDefaultRef() SetRepoFullPath() SetRepoLocalName() SetSha() }
RepoI interface defined for mocking purposes.
type RepoList ¶
type RepoList []Repo
RepoList is a slice of Repo structs
func GetConfigRepoList ¶
GetConfigRepoList - tries to read config files from the list, if these are existing and returns list of repositories, if any file is missing - it fails
type RepoStatus ¶
type RepoStatus struct { Processed bool // by default repository is not processed, and won't be if skipped NotOnRefBranch bool // repository checked out branch is not trunk but feature branch UncommittedChanges bool // there are no uncommitted or staged changes in the branch OperationErrorMessage string // last operation error message if any Error bool // last operation error message if any }
RepoStatus - data structure to track repository status