plumbing

package
v4.0.0-...-9b8478d Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigBlobCacheFailOnMissingSubmodules is the name of the configuration option for
	// BlobCache.Configure() to check if the referenced submodules are registered in .gitignore.
	ConfigBlobCacheFailOnMissingSubmodules = "BlobCache.FailOnMissingSubmodules"
	// DependencyBlobCache identifies the dependency provided by BlobCache.
	DependencyBlobCache = "blob_cache"
)
View Source
const (
	// DependencyDay is the name of the dependency which DaysSinceStart provides - the number
	// of days since the first commit in the analysed sequence.
	DependencyDay = "day"

	// FactCommitsByDay contains the mapping between day indices and the corresponding commits.
	FactCommitsByDay = "DaysSinceStart.Commits"
)
View Source
const (
	// ConfigFileDiffDisableCleanup is the name of the configuration option (FileDiff.Configure())
	// to suppress diffmatchpatch.DiffCleanupSemanticLossless() which is supposed to improve
	// the human interpretability of diffs.
	ConfigFileDiffDisableCleanup = "FileDiff.NoCleanup"

	// DependencyFileDiff is the name of the dependency provided by FileDiff.
	DependencyFileDiff = "file_diff"
)
View Source
const (
	// RenameAnalysisDefaultThreshold specifies the default percentage of common lines in a pair
	// of files to consider them linked. The exact code of the decision is sizesAreClose().
	RenameAnalysisDefaultThreshold = 90

	// ConfigRenameAnalysisSimilarityThreshold is the name of the configuration option
	// (RenameAnalysis.Configure()) which sets the similarity threshold.
	ConfigRenameAnalysisSimilarityThreshold = "RenameAnalysis.SimilarityThreshold"
)
View Source
const (
	// DependencyTreeChanges is the name of the dependency provided by TreeDiff.
	DependencyTreeChanges = "changes"
	// ConfigTreeDiffEnableBlacklist is the name of the configuration option
	// (TreeDiff.Configure()) which allows to skip blacklisted directories.
	ConfigTreeDiffEnableBlacklist = "TreeDiff.EnableBlacklist"
	// ConfigTreeDiffBlacklistedDirs s the name of the configuration option
	// (TreeDiff.Configure()) which allows to set blacklisted directories.
	ConfigTreeDiffBlacklistedDirs = "TreeDiff.BlacklistedDirs"
	// ConfigTreeDiffLanguages is the name of the configuration option (TreeDiff.Configure())
	// which sets the list of programming languages to analyze. Language names are at
	// https://doc.bblf.sh/languages.html Names are joined with a comma ",".
	// "all" is the special name which disables this filter.
	ConfigTreeDiffLanguages = "TreeDiff.Languages"
)

Variables

This section is empty.

Functions

func BlobToString

func BlobToString(file *object.Blob) (string, error)

BlobToString reads *object.Blob and returns its contents as a string.

func CountLines

func CountLines(file *object.Blob) (int, error)

CountLines returns the number of lines in a *object.Blob.

Types

type BlobCache

type BlobCache struct {
	core.NoopMerger
	// Specifies how to handle the situation when we encounter a git submodule - an object
	// without the blob. If true, we look inside .gitmodules and if we don't find it,
	// raise an error. If false, we do not look inside .gitmodules and always succeed.
	FailOnMissingSubmodules bool
	// contains filtered or unexported fields
}

BlobCache loads the blobs which correspond to the changed files in a commit. It is a PipelineItem. It must provide the old and the new objects; "blobCache" rotates and allows to not load the same blobs twice. Outdated objects are removed so "blobCache" never grows big.

func (*BlobCache) Configure

func (blobCache *BlobCache) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*BlobCache) Consume

func (blobCache *BlobCache) 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 (*BlobCache) Fork

func (blobCache *BlobCache) Fork(n int) []core.PipelineItem

Fork clones this PipelineItem.

func (*BlobCache) Initialize

func (blobCache *BlobCache) Initialize(repository *git.Repository)

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 (*BlobCache) ListConfigurationOptions

func (blobCache *BlobCache) ListConfigurationOptions() []core.ConfigurationOption

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

func (*BlobCache) Name

func (blobCache *BlobCache) Name() string

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

func (*BlobCache) Provides

func (blobCache *BlobCache) 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 (*BlobCache) Requires

func (blobCache *BlobCache) 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.

type DaysSinceStart

type DaysSinceStart struct {
	core.NoopMerger
	// contains filtered or unexported fields
}

DaysSinceStart provides the relative date information for every commit. It is a PipelineItem.

func (*DaysSinceStart) Configure

func (days *DaysSinceStart) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*DaysSinceStart) Consume

func (days *DaysSinceStart) 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 (*DaysSinceStart) Fork

func (days *DaysSinceStart) Fork(n int) []core.PipelineItem

Fork clones this PipelineItem.

func (*DaysSinceStart) Initialize

func (days *DaysSinceStart) Initialize(repository *git.Repository)

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 (*DaysSinceStart) ListConfigurationOptions

func (days *DaysSinceStart) ListConfigurationOptions() []core.ConfigurationOption

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

func (*DaysSinceStart) Name

func (days *DaysSinceStart) Name() string

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

func (*DaysSinceStart) Provides

func (days *DaysSinceStart) 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 (*DaysSinceStart) Requires

func (days *DaysSinceStart) 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.

type FileDiff

type FileDiff struct {
	core.NoopMerger
	CleanupDisabled bool
}

FileDiff calculates the difference of files which were modified. It is a PipelineItem.

func (*FileDiff) Configure

func (diff *FileDiff) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*FileDiff) Consume

func (diff *FileDiff) 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 (*FileDiff) Fork

func (diff *FileDiff) Fork(n int) []core.PipelineItem

Fork clones this PipelineItem.

func (*FileDiff) Initialize

func (diff *FileDiff) Initialize(repository *git.Repository)

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 (*FileDiff) ListConfigurationOptions

func (diff *FileDiff) ListConfigurationOptions() []core.ConfigurationOption

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

func (*FileDiff) Name

func (diff *FileDiff) Name() string

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

func (*FileDiff) Provides

func (diff *FileDiff) 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 (*FileDiff) Requires

func (diff *FileDiff) 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.

type FileDiffData

type FileDiffData struct {
	OldLinesOfCode int
	NewLinesOfCode int
	Diffs          []diffmatchpatch.Diff
}

FileDiffData is the type of the dependency provided by FileDiff.

type FileGetter

type FileGetter func(path string) (*object.File, error)

FileGetter defines a function which loads the Git file by the specified path. The state can be arbitrary though here it always corresponds to the currently processed commit.

type RenameAnalysis

type RenameAnalysis struct {
	core.NoopMerger
	// SimilarityThreshold adjusts the heuristic to determine file renames.
	// It has the same units as cgit's -X rename-threshold or -M. Better to
	// set it to the default value of 90 (90%).
	SimilarityThreshold int
	// contains filtered or unexported fields
}

RenameAnalysis improves TreeDiff's results by searching for changed blobs under different paths which are likely to be the result of a rename with subsequent edits. RenameAnalysis is a PipelineItem.

func (*RenameAnalysis) Configure

func (ra *RenameAnalysis) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*RenameAnalysis) Consume

func (ra *RenameAnalysis) 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 (*RenameAnalysis) Fork

func (ra *RenameAnalysis) Fork(n int) []core.PipelineItem

Fork clones this PipelineItem.

func (*RenameAnalysis) Initialize

func (ra *RenameAnalysis) Initialize(repository *git.Repository)

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 (*RenameAnalysis) ListConfigurationOptions

func (ra *RenameAnalysis) ListConfigurationOptions() []core.ConfigurationOption

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

func (*RenameAnalysis) Name

func (ra *RenameAnalysis) Name() string

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

func (*RenameAnalysis) Provides

func (ra *RenameAnalysis) 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 (*RenameAnalysis) Requires

func (ra *RenameAnalysis) 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.

type TreeDiff

type TreeDiff struct {
	core.NoopMerger
	SkipDirs  []string
	Languages map[string]bool
	// contains filtered or unexported fields
}

TreeDiff generates the list of changes for a commit. A change can be either one or two blobs under the same path: "before" and "after". If "before" is nil, the change is an addition. If "after" is nil, the change is a removal. Otherwise, it is a modification. TreeDiff is a PipelineItem.

func (*TreeDiff) Configure

func (treediff *TreeDiff) Configure(facts map[string]interface{})

Configure sets the properties previously published by ListConfigurationOptions().

func (*TreeDiff) Consume

func (treediff *TreeDiff) 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 (*TreeDiff) Fork

func (treediff *TreeDiff) Fork(n int) []core.PipelineItem

Fork clones this PipelineItem.

func (*TreeDiff) Initialize

func (treediff *TreeDiff) Initialize(repository *git.Repository)

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 (*TreeDiff) ListConfigurationOptions

func (treediff *TreeDiff) ListConfigurationOptions() []core.ConfigurationOption

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

func (*TreeDiff) Name

func (treediff *TreeDiff) Name() string

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

func (*TreeDiff) Provides

func (treediff *TreeDiff) 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 (*TreeDiff) Requires

func (treediff *TreeDiff) 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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