utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDotGit

func GetDotGit(providedDotGitPath string) (string, error)

Looks for the .git directory in the current directory and its parents.

func GetPlainGitLogFromPreviousBuild

func GetPlainGitLogFromPreviousBuild(serverDetails *utilsconfig.ServerDetails, buildConfiguration *build.BuildConfiguration, gitDetails GitLogDetails, previousBuildPos int) (string, error)

Returns the git log output for the VCS revision for the previous build in position previousBuildPos. For previousBuildPos 0 the latest build is returned, for an input 1 the latest -1 is returned, etc. previousBuildPos must be 0 or above. Calls git log with a custom format, and returns the output as is. Return RevisionRangeError if revision isn't found (due to git history modification).

func ParseGitLogFromLastBuild

func ParseGitLogFromLastBuild(serverDetails *utilsconfig.ServerDetails, buildConfiguration *build.BuildConfiguration, gitDetails GitLogDetails, logRegExp *gofrogcmd.CmdOutputPattern) error

Parses git commits from the last build's VCS revision. Calls git log with a custom format, and parses each line of the output with regexp. logRegExp is used to parse the log lines.

func ParseGitLogFromLastVcsRevision

func ParseGitLogFromLastVcsRevision(gitDetails GitLogDetails, logRegExp *gofrogcmd.CmdOutputPattern, lastVcsRevision string) (err error)

Parses git log line by line, using the parser provided in logRegExp. Git log is parsed from lastVcsRevision to HEAD.

Types

type GitLogDetails

type GitLogDetails struct {
	LogLimit     int
	PrettyFormat string
	// Optional
	DotGitPath string
}

type LogCmd

type LogCmd struct {
	// contains filtered or unexported fields
}

func (*LogCmd) GetCmd

func (logCmd *LogCmd) GetCmd() *exec.Cmd

func (*LogCmd) GetEnv

func (logCmd *LogCmd) GetEnv() map[string]string

func (*LogCmd) GetErrWriter

func (logCmd *LogCmd) GetErrWriter() io.WriteCloser

func (*LogCmd) GetStdWriter

func (logCmd *LogCmd) GetStdWriter() io.WriteCloser

type RevisionRangeError

type RevisionRangeError struct {
	ErrorMsg string
}

Error to be thrown when revision could not be found in the git revision range.

func (RevisionRangeError) Error

func (err RevisionRangeError) Error() string

Jump to

Keyboard shortcuts

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