Documentation
¶
Overview ¶
Handles summations over commits.
Index ¶
- Constants
- Variables
- func TallyCommits(commits iter.Seq2[git.Commit, error], opts TallyOpts) (map[string]Tally, error)
- type FinalTally
- type Resolution
- type TalliesByPath
- type Tally
- type TallyMode
- type TallyOpts
- type TimeBucket
- func Rebucket(buckets []TimeBucket, resolution Resolution, end time.Time) []TimeBucket
- func TallyCommitsByDate(commits iter.Seq2[git.Commit, error], opts TallyOpts, end time.Time) (_ []TimeBucket, err error)
- func TallyCommitsTimeline(commits iter.Seq2[git.Commit, error], opts TallyOpts, end time.Time) ([]TimeBucket, error)
- type TimeSeries
- type TreeNode
Constants ¶
const NoDiffPathname = ".git-who-no-diff-commits"
Variables ¶
var EmptyTreeErr = errors.New("No commits; tree is empty.")
Functions ¶
Types ¶
type FinalTally ¶
type FinalTally struct { AuthorName string AuthorEmail string Commits int // Num commits editing paths in tree by this author LinesAdded int // Num lines added to paths in tree by author LinesRemoved int // Num lines deleted from paths in tree by author FileCount int // Num of file paths in working dir touched by author LastCommitTime time.Time }
Metrics tallied for a single author while walking git log.
This kind of tally cannot be combined with others because intermediate information has been lost.
func Rank ¶
func Rank(tallies map[string]Tally, mode TallyMode) []FinalTally
Sort tallies according to mode.
func (FinalTally) Compare ¶
func (a FinalTally) Compare(b FinalTally, mode TallyMode) int
func (FinalTally) SortKey ¶
func (t FinalTally) SortKey(mode TallyMode) int64
type Resolution ¶
type Resolution struct {
// contains filtered or unexported fields
}
Resolution for a time series.
apply - Truncate time to its time bucket label - Format the date to a label for the bucket next - Get next time in series, given a time
func CalcResolution ¶
func CalcResolution(start time.Time, end time.Time) Resolution
type TalliesByPath ¶
func TallyCommitsByPath ¶
func TallyCommitsByPath( commits iter.Seq2[git.Commit, error], opts TallyOpts, ) (TalliesByPath, error)
Tally metrics per author per path.
func (TalliesByPath) Combine ¶
func (left TalliesByPath) Combine(right TalliesByPath) TalliesByPath
func (TalliesByPath) Reduce ¶
func (byPath TalliesByPath) Reduce() map[string]Tally
Reduce by-path tallies to a single tally for each author.
type Tally ¶
type Tally struct {
// contains filtered or unexported fields
}
A non-final tally that can be combined with other tallies and then finalized
func (Tally) Final ¶
func (t Tally) Final() FinalTally
type TallyOpts ¶
type TallyOpts struct { Mode TallyMode Key func(c git.Commit) string // Unique ID for author CountMerges bool }
func (TallyOpts) IsDiffMode ¶
Whether we need --stat and --summary data from git log for this tally mode
type TimeBucket ¶
type TimeBucket struct { Name string Time time.Time Tally FinalTally // Winning author's tally TotalTally FinalTally // Overall tally for all authors // contains filtered or unexported fields }
func Rebucket ¶
func Rebucket( buckets []TimeBucket, resolution Resolution, end time.Time, ) []TimeBucket
func TallyCommitsByDate ¶
func TallyCommitsByDate( commits iter.Seq2[git.Commit, error], opts TallyOpts, end time.Time, ) (_ []TimeBucket, err error)
Returns tallies grouped by calendar date.
func TallyCommitsTimeline ¶
func TallyCommitsTimeline( commits iter.Seq2[git.Commit, error], opts TallyOpts, end time.Time, ) ([]TimeBucket, error)
Returns a list of "time buckets" with tallies for each date.
The resolution / size of the buckets is determined based on the duration between the first commit and end time.
func (TimeBucket) Combine ¶
func (a TimeBucket) Combine(b TimeBucket) TimeBucket
func (TimeBucket) Rank ¶
func (b TimeBucket) Rank(mode TallyMode) TimeBucket
func (TimeBucket) TotalValue ¶
func (b TimeBucket) TotalValue(mode TallyMode) int
func (TimeBucket) Value ¶
func (b TimeBucket) Value(mode TallyMode) int
type TimeSeries ¶
type TimeSeries []TimeBucket
func (TimeSeries) Combine ¶
func (a TimeSeries) Combine(b TimeSeries) TimeSeries
type TreeNode ¶
type TreeNode struct { Tally FinalTally Children map[string]*TreeNode InWorkTree bool // In git working tree/directory // contains filtered or unexported fields }
A file tree of edits to the repo
func TallyCommitsTree ¶
func TallyCommitsTree( commits iter.Seq2[git.Commit, error], opts TallyOpts, worktreePaths map[string]bool, gitRootPath string, ) (*TreeNode, error)
* TallyCommitsTree() returns a tree of nodes mirroring the working directory * with a tally for each node.