domain

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffTrees

func DiffTrees(base, target Tree) ([]fdiff.FilePatch, error)

DiffTrees calculates diffs between two trees.

Diff implementations is referred from go-git's (*git.Worktree).Status() method.

func SortCloneSets

func SortCloneSets(sets []*CloneSet)

Types

type Clone

type Clone struct {
	Filename string
	StartL   int
	EndL     int
	Distance float64
	// Sources indicate from which queries this co-change candidate was detected
	Sources []*Source
}

func (Clone) Key

func (c Clone) Key() string

type CloneSet

type CloneSet struct {
	Changed []*Clone
	Missing []*Clone
}

func (*CloneSet) ChangedProportion

func (cs *CloneSet) ChangedProportion() float64

func (*CloneSet) Sort

func (cs *CloneSet) Sort()

type Searcher

type Searcher interface {
	Files() ([]string, error)
	Open(name string) (SearcherFile, error)
}

Searcher is an interface for use with clone search backend implementations.

func NewSearcherFromTree

func NewSearcherFromTree(tree Tree) Searcher

type SearcherFile

type SearcherFile interface {
	Name() string
	IsBinary() (bool, error)
	Content() ([]byte, error)
}

type Source

type Source struct {
	Filename string
	StartL   int
	EndL     int
}

func (Source) Key

func (s Source) Key() string

func (Source) SlideCut

func (s Source) SlideCut(window int) []*Source

SlideCut cuts this source into multiple sources, sliding by the specified window size.

type Tree

type Tree interface {
	// String should return a short human-readable representation of this tree.
	String() string
	// Tree MAY return concrete go-git tree implementation, for use with direct comparison from the other tree
	// and with the go-git embedded rename detection function.
	//
	// If Tree() returns false, comparison will fallback to Noder() diffing.
	Tree() (t *object.Tree, err error, ok bool)
	// Noder returns noder.Noder for diffing changes from the other noder.Noder instance.
	Noder() (noder.Noder, error)
	// FilterIgnoredChanges SHOULD filter ignored changes (such as paths specified in .gitignore), if any.
	FilterIgnoredChanges(changes merkletrie.Changes) merkletrie.Changes
	// Reader returns io.ReadCloser to the file contents.
	Reader(path string) (io.ReadCloser, error)
}

Tree represents a tree-like filesystem with various backends. Tree interface is used for comparison between two filesystem snapshots without depending on a specific backend implementation.

func NewGoGitCommitTree

func NewGoGitCommitTree(commit *object.Commit) Tree

func NewGoGitWorkTree

func NewGoGitWorkTree(worktree *git.Worktree) (Tree, error)

func NewGoGitWorktreeWithOverlay

func NewGoGitWorktreeWithOverlay(worktree *git.Worktree, overlay map[string]string) (Tree, error)

Jump to

Keyboard shortcuts

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