commits

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PairsToCommitsInCommon added in v0.1.0

func PairsToCommitsInCommon(filesOrComponents []string, componentOrFileToCommits map[string]CommitHashes) map[string]CommitHashes

PairsToCommitsInCommon Puts components or files into pairs and counts the number of commits that they share. Returns a map of the pair to the number of shared commits.

The structure of the map is: file1:file2 -> []string{CommitHashes...} The resulting map will contain pairs of components or files that have at least 1 shared commit.

func SplitCommitsIntoBucketsOfDays

func SplitCommitsIntoBucketsOfDays(time time.Time, commitParts []*PartOfCommit, bucketDays []int) map[int][]*PartOfCommit

SplitCommitsIntoBucketsOfDays commits into buckets based on the number of days between the commit and the time passed in. The buckets are the number of days in the bucketDays array. For example, if bucketDays is [7, 30, 90], then the commits will be split into 7 days, 30 days, and 90 days. This is useful for seeing code churn over time. The buckets are returned as a map of days to commits. The time passed in is the time that the buckets are relative to. The commitParts are the commits to split into buckets, and they are assumed to be sorted by time in descending order.

Types

type CommitHashes

type CommitHashes []string

func SharedCommitsForGroup added in v0.1.0

func SharedCommitsForGroup(group []string, componentOrFileToCommits map[string]CommitHashes) CommitHashes

type CommitPartMap

type CommitPartMap map[string][]*PartOfCommit

type CommitStats

type CommitStats struct {
	CommitCount                int
	AdditionCount              int
	DeletionCount              int
	UniqueFileChangeCount      int
	UniqueComponentChangeCount int
	UniqueAuthorCount          int
	OldestCommitAgeInDays      int
}

func GetStats

func GetStats(basedOn time.Time, commitParts []*PartOfCommit) *CommitStats

GetStats Gets the stats for a group of commits. Assumes that commits are sorted in reverse chronological order.

type PartOfCommit

type PartOfCommit struct {
	Component   string
	Commit      string
	Time        time.Time
	File        string
	Author      string
	AuthorEmail string
	Message     string
	Additions   int
	Deletions   int
}

type Splitted

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

func Split

func Split(basedOn time.Time, dayBuckets []int, commitParts []*PartOfCommit) *Splitted

func (*Splitted) CommitParts added in v0.1.0

func (ms *Splitted) CommitParts() []*PartOfCommit

func (*Splitted) ComponentToCommitHashes

func (ms *Splitted) ComponentToCommitHashes() map[string]CommitHashes

func (*Splitted) DayBuckets

func (ms *Splitted) DayBuckets() map[int]*Splitted

DayBuckets may return nil if the commits were not split by day buckets. This is the case if this set of Splitted commits were already split into day buckets.

func (*Splitted) FileToCommitHashes

func (ms *Splitted) FileToCommitHashes() map[string]CommitHashes

func (*Splitted) SplitByAuthor

func (ms *Splitted) SplitByAuthor() CommitPartMap

func (*Splitted) SplitByCommitHash

func (ms *Splitted) SplitByCommitHash() CommitPartMap

func (*Splitted) SplitByComponent

func (ms *Splitted) SplitByComponent() CommitPartMap

func (*Splitted) SplitByFile

func (ms *Splitted) SplitByFile() CommitPartMap

Jump to

Keyboard shortcuts

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