hercules.v9: gopkg.in/src-d/hercules.v9/internal/plumbing/identity Index | Files

package identity

import "gopkg.in/src-d/hercules.v9/internal/plumbing/identity"

Index

Package Files

identity.go mailmap.go

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"
)

func ParseMailmap Uses

func ParseMailmap(contents string) map[string]object.Signature

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.

type Detector Uses

type Detector struct {
    core.NoopMerger
    // PeopleDict maps email || name  -> developer id
    PeopleDict map[string]int
    // ReversedPeopleDict maps developer id -> description
    ReversedPeopleDict []string
}

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 Uses

func (detector *Detector) Configure(facts map[string]interface{}) error

Configure sets the properties previously published by ListConfigurationOptions().

func (*Detector) Consume Uses

func (detector *Detector) Consume(deps map[string]interface{}) (map[string]interface{}, error)

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 Uses

func (detector *Detector) Fork(n int) []core.PipelineItem

Fork clones this PipelineItem.

func (*Detector) GeneratePeopleDict Uses

func (detector *Detector) GeneratePeopleDict(commits []*object.Commit)

GeneratePeopleDict loads author signatures from the specified list of Git commits.

func (*Detector) Initialize Uses

func (detector *Detector) Initialize(repository *git.Repository) error

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 Uses

func (detector *Detector) ListConfigurationOptions() []core.ConfigurationOption

ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.

func (*Detector) LoadPeopleDict Uses

func (detector *Detector) LoadPeopleDict(path string) error

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) MergeReversedDicts Uses

func (detector Detector) MergeReversedDicts(rd1, rd2 []string) (map[string][3]int, []string)

MergeReversedDicts joins two identity lists together, excluding duplicates, in-order. The returned mapping's values are: final index, index in first, index in second (-1 for a miss).

func (*Detector) Name Uses

func (detector *Detector) Name() string

Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.

func (*Detector) Provides Uses

func (detector *Detector) Provides() []string

Provides returns the list of names of entities which are produced by this PipelineItem. Each produced entity will be inserted into `deps` of dependent Consume()-s according to this list. Also used by core.Registry to build the global map of providers.

func (*Detector) Requires Uses

func (detector *Detector) Requires() []string

Requires returns the list of names of entities which are needed by this PipelineItem. Each requested entity will be inserted into `deps` of Consume(). In turn, those entities are Provides() upstream.

Package identity imports 8 packages (graph) and is imported by 2 packages. Updated 2019-04-26. Refresh now. Tools for package owners.