gitcmd

package
v0.0.0-...-7101d23 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const REPORT_PATH = "./commit.log"

Variables

View Source
var (

	//git log
	LOG_TPL            = "git -C %s --no-pager log %s --no-merges "
	LOG_FORMAT_TPL     = `--format=format:'%h*-*%an*-*%ct*-*%s' ` //使用*-*作为分隔符
	LOG_AUTHOR_TPL     = `--author=%s `
	LOG_START_DATE_TPL = `--since=%s `
	LOG_END_DATE_TPL   = `--until=%s `
	LOG_RECENTN_TPL    = `-n %d `

	// git show
	SHOW_TPL = "git show %s"

	// git status
	STATUS_TPL = "git -C %s status"

	// git status in short result
	STATUS_CHECK_TPL = "git -C %s status -s"

	//git pull
	GIT_PULL = `git -C %s pull --rebase`

	// git clone
	CLONE_TPL = "git clone %s %s"

	// git lab group api
	// gitlab doc  https://docs.gitlab.com/ee/api/groups.html#details-of-a-group
	GITLAB_GROUP_DETAIL = "%s://%s/api/v4/groups%s?private_token=%s"

	// Determine if the current directory is a git repository
	EXIST_GIT_REPO = "git rev-parse --is-inside-work-tree"

	//git Branch
	GIT_BRANCH = `git branch`
)

Functions

func CloneGroup

func CloneGroup(groupUrl, token, targetDir string)

CloneGroup 获取所有项目仓库

func GetAllGitRepoCommitLog

func GetAllGitRepoCommitLog(detail bool, recentN int16, dir, author, start, end string, branchs bool) (*[]ResultLog, error)

GetAllGitRepoCommitLog 封装所有仓库的提交信息

func GetAllGitRepoStatus

func GetAllGitRepoStatus(dir string)

GetAllGitRepoStatus 查看所有仓库的状态

func GetChangedFile

func GetChangedFile(commitId string) ([]string, error)

GetChangedFile 获取本次提交变动的文件名

func GetCommitLog

func GetCommitLog(detail bool, recentN int16, dir, author, start, end string, branchs bool) (*[]CommitLog, error)

GetCommitLog 获取提交日志

func ListRepoAllBranch

func ListRepoAllBranch(repo string) (re *branchInfo)

ListRepoAllBranch list all git Branch under repository

func UpdateAllGitRepo

func UpdateAllGitRepo(dir string)

UpdateAllGitRepo 更新所有仓库

Types

type CommitLog

type CommitLog struct {
	Branch       string   //Branch
	CommitHash   string   //abbreviated commit hash
	Username     string   //username
	CommitAt     string   //commit time
	CommitMsg    string   //commit log
	FilesChanged []string //changed file arr
}

CommitLog 提交记录

type ConsoleOutput

type ConsoleOutput struct {
}

func (*ConsoleOutput) Output

func (c *ConsoleOutput) Output(resLogs *[]ResultLog)

type FileOutput

type FileOutput struct {
}

func (*FileOutput) Output

func (c *FileOutput) Output(resLogs *[]ResultLog)

type OutputFormatter

type OutputFormatter interface {
	Output(*[]ResultLog)
}

type ProjectInfo

type ProjectInfo struct {
	HttpUrlToRepo string
	Path          string
}

type ResultLog

type ResultLog struct {
	RepoName   string //git repository name
	CommitLogs *[]CommitLog
}

ResultLog 封装日志分析结果

Jump to

Keyboard shortcuts

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