Documentation ¶
Index ¶
- Constants
- func MergeReversedDictsIdentities(rd1, rd2 []string) (map[string]MergedIndex, []string)
- func MergeReversedDictsLiteral(rd1, rd2 []string) (map[string]MergedIndex, []string)
- func ParseMailmap(contents string) map[string]object.Signature
- type Detector
- func (detector *Detector) Configure(facts map[string]interface{}) error
- func (detector *Detector) Consume(deps map[string]interface{}) (map[string]interface{}, error)
- func (detector *Detector) Fork(n int) []core.PipelineItem
- func (detector *Detector) GeneratePeopleDict(commits []*object.Commit)
- func (detector *Detector) Initialize(repository *git.Repository) error
- func (detector *Detector) ListConfigurationOptions() []core.ConfigurationOption
- func (detector *Detector) LoadPeopleDict(path string) error
- func (detector *Detector) Name() string
- func (detector *Detector) Provides() []string
- func (detector *Detector) Requires() []string
- type MergedIndex
Constants ¶
const ( // AuthorMissing is the internal author index which denotes any unmatched identities // (Detector.Consume()). It may *not* be (1 << 18) - 1, see BurndownAnalysis.packPersonWithDay(). AuthorMissing = (1 << 18) - 2 // AuthorMissingName is the string name which corresponds to AuthorMissing. AuthorMissingName = "<unmatched>" // FactIdentityDetectorPeopleDict is the name of the fact which is inserted in // Detector.Configure(). It corresponds to Detector.PeopleDict - the mapping // from the signatures to the author indices. FactIdentityDetectorPeopleDict = "IdentityDetector.PeopleDict" // FactIdentityDetectorReversedPeopleDict is the name of the fact which is inserted in // Detector.Configure(). It corresponds to Detector.ReversedPeopleDict - // the mapping from the author indices to the main signature. FactIdentityDetectorReversedPeopleDict = "IdentityDetector.ReversedPeopleDict" // ConfigIdentityDetectorPeopleDictPath is the name of the configuration option // (Detector.Configure()) which allows to set the external PeopleDict mapping from a file. ConfigIdentityDetectorPeopleDictPath = "IdentityDetector.PeopleDictPath" // FactIdentityDetectorPeopleCount is the name of the fact which is inserted in // Detector.Configure(). It is equal to the overall number of unique authors // (the length of ReversedPeopleDict). FactIdentityDetectorPeopleCount = "IdentityDetector.PeopleCount" // DependencyAuthor is the name of the dependency provided by Detector. DependencyAuthor = "author" )
Variables ¶
This section is empty.
Functions ¶
func MergeReversedDictsIdentities ¶
func MergeReversedDictsIdentities(rd1, rd2 []string) (map[string]MergedIndex, []string)
MergeReversedDictsIdentities joins two identity lists together, excluding duplicates. The strings are split by "|" and we find the connected components.. The returned mapping's keys are the unique strings in `rd1 ∪ rd2`, and the values are: 1. Index after merging. 2. Corresponding index in the first array - `rd1`. -1 means that it does not exist. 3. Corresponding index in the second array - `rd2`. -1 means that it does not exist.
func MergeReversedDictsLiteral ¶
func MergeReversedDictsLiteral(rd1, rd2 []string) (map[string]MergedIndex, []string)
MergeReversedDictsLiteral joins two string lists together, excluding duplicates, in-order. The string comparisons are the usual ones. The returned mapping's keys are the unique strings in `rd1 ∪ rd2`, and the values are: 1. Index after merging. 2. Corresponding index in the first array - `rd1`. -1 means that it does not exist. 3. Corresponding index in the second array - `rd2`. -1 means that it does not exist.
func ParseMailmap ¶
ParseMailmap parses the contents of .mailmap and returns the mapping between signature parts. It does *not* follow the full signature matching convention, that is, developers are identified by email and by name independently.
Types ¶
type Detector ¶
type Detector struct { core.NoopMerger // PeopleDict maps email || name -> developer id PeopleDict map[string]int // ReversedPeopleDict maps developer id -> description ReversedPeopleDict []string // contains filtered or unexported fields }
Detector determines the author of a commit. Same person can commit under different signatures, and we apply some heuristics to merge those together. It is a PipelineItem.
func (*Detector) Configure ¶
Configure sets the properties previously published by ListConfigurationOptions().
func (*Detector) Consume ¶
Consume runs this PipelineItem on the next commit data. `deps` contain all the results from upstream PipelineItem-s as requested by Requires(). Additionally, DependencyCommit is always present there and represents the analysed *object.Commit. This function returns the mapping with analysis results. The keys must be the same as in Provides(). If there was an error, nil is returned.
func (*Detector) Fork ¶
func (detector *Detector) Fork(n int) []core.PipelineItem
Fork clones this PipelineItem.
func (*Detector) GeneratePeopleDict ¶
GeneratePeopleDict loads author signatures from the specified list of Git commits.
func (*Detector) Initialize ¶
Initialize resets the temporary caches and prepares this PipelineItem for a series of Consume() calls. The repository which is going to be analysed is supplied as an argument.
func (*Detector) ListConfigurationOptions ¶
func (detector *Detector) ListConfigurationOptions() []core.ConfigurationOption
ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.
func (*Detector) LoadPeopleDict ¶
LoadPeopleDict loads author signatures from a text file. The format is one signature per line, and the signature consists of several keys separated by "|". The first key is the main one and used to reference all the rest.
func (*Detector) Name ¶
Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.
type MergedIndex ¶
MergedIndex is the result of merging `rd1[First]` and `rd2[Second]`: the index in the final reversed dictionary. -1 for `First` or `Second` means that the corresponding string does not exist in respectively `rd1` and `rd2`. See also: * MergeReversedDictsLiteral() * MergeReversedDictsIdentities()