diff

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DifferInit

type DifferInit struct {
	// contains filtered or unexported fields
}

DifferInit Code DifferInitence Analyzer

func NewDifferInit

func NewDifferInit(cfg *config.Config) (*DifferInit, error)

NewDifferInit creates a new code DifferInit

func (*DifferInit) AnalyzeChanges

func (d *DifferInit) AnalyzeChanges() ([]*FileChange, error)

AnalyzeChanges analyzes code changes between new and initial commit

type DifferInterface

type DifferInterface interface {
	AnalyzeChanges() ([]*FileChange, error)
}

type DifferV1

type DifferV1 struct {
	// contains filtered or unexported fields
}

DifferV1 is the first version of the code difference analyzer

func NewDifferV1

func NewDifferV1(cfg *config.Config) (*DifferV1, error)

NewDifferV1 creates a new code difference analyzer

func (*DifferV1) AnalyzeChanges

func (d *DifferV1) AnalyzeChanges() ([]*FileChange, error)

AnalyzeChanges analyzes code changes between two branches

type DifferV2

type DifferV2 struct {
	// contains filtered or unexported fields
}

DifferV2 is the second version of the code difference analyzer

func NewDifferV2

func NewDifferV2(cfg *config.Config) (*DifferV2, error)

NewDifferV2 creates a new code difference analyzer

func (*DifferV2) AnalyzeChanges

func (d *DifferV2) AnalyzeChanges() ([]*FileChange, error)

AnalyzeChanges analyzes code changes between two branches

type DifferV3

type DifferV3 struct {
	// contains filtered or unexported fields
}

This version cannot recognize the scenario of file migration and modification. All migrated files are regarded as deleted and newly created.

Blame the limited capabilities of go-git. I have tried various methods but still got no result.

DifferV3 is the third version of the code difference analyzer

func NewDifferV3

func NewDifferV3(cfg *config.Config) (*DifferV3, error)

NewDifferV3 creates a new code DifferV3

func (*DifferV3) AnalyzeChanges

func (d *DifferV3) AnalyzeChanges() ([]*FileChange, error)

AnalyzeChanges analyzes code changes between two branches

type FileChange

type FileChange struct {
	Path        string      `json:"path"` // file path
	LineChanges LineChanges `json:"line_changes"`
}

FileChange represents file change information

type LineChange

type LineChange struct {
	Start int `json:"start"` // starting line number of new code
	Lines int `json:"lines"` // number of lines of new code
}

LineChange represents line-level change information

type LineChanges

type LineChanges []LineChange

LineChanges is a list of line changes

func (LineChanges) Search

func (l LineChanges) Search(line int) int

Search searches for a line change

Jump to

Keyboard shortcuts

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