diff

package
v1.0.0-beta.62.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package diff contains libraries for diffing packages.

Index

Constants

View Source
const (
	// localPackageSource represents the local package
	LocalPackageSource string = "local"
	// remotePackageSource represents the remote version of the package
	RemotePackageSource string = "remote"
	// targetRemotePackageSource represents the targeted remote version of a package
	TargetRemotePackageSource string = "target"
)

A collection of user-readable "source" definitions for diffed packages.

Variables

View Source
var SupportedDiffTypes = []Type{TypeLocal, TypeRemote, TypeCombined, Type3Way}

Functions

func NameStagingDirectory

func NameStagingDirectory(source, ref string) string

NameStagingDirectory assigns a name that matches the package source information

func PkgDiff

func PkgDiff(pkg1, pkg2 string) (sets.String, error)

func SupportedDiffTypesLabel

func SupportedDiffTypesLabel() string

Types

type Command

type Command struct {
	// Path to the local package directory
	Path string

	// Ref is the target Ref in the upstream source package to compare against
	Ref string

	// DiffType specifies the type of changes to show
	DiffType Type

	// Difftool refers to diffing commandline tool for showing changes.
	DiffTool string

	// DiffToolOpts refers to the commandline options to for the diffing tool.
	DiffToolOpts string

	// When Debug is true, command will run with verbose logging and will not
	// cleanup the staged packages to assist with debugging.
	Debug bool

	// Output is an io.Writer where command will write the output of the
	// command.
	Output io.Writer

	// PkgDiffer specifies package differ
	PkgDiffer PkgDiffer

	// PkgGetter specifies packaging sourcing adapter
	PkgGetter PkgGetter
}

Command shows changes in local package relative to upstream source pkg, changes in upstream source package between original and target version etc.

func (*Command) DefaultValues

func (c *Command) DefaultValues()

DefaultValues sets up the default values for the command.

func (*Command) Run

func (c *Command) Run(ctx context.Context) error

func (*Command) Validate

func (c *Command) Validate() error

type PkgDiffer

type PkgDiffer interface {
	Diff(pkgs ...string) error
}

PkgDiffer knows how to compare given packages.

type PkgGetter

type PkgGetter interface {
	GetPkg(ctx context.Context, stagingDir, targetDir, repo, path, ref string) (dir string, err error)
}

PkgGetter knows how to fetch a package given a git repo, path and ref.

type Type

type Type string

Type represents type of diff comparison to be performed.

const (
	// TypeLocal shows the changes in local pkg relative to upstream source pkg at original version
	TypeLocal Type = "local"
	// TypeRemote shows changes in the upstream source pkg between original and target version
	TypeRemote Type = "remote"
	// TypeCombined shows changes in local pkg relative to upstream source pkg at target version
	TypeCombined Type = "combined"
	// 3way shows changes in local and remote changes side-by-side
	Type3Way Type = "3way"
)

func (Type) String

func (dt Type) String() string

String implements Stringer.

Jump to

Keyboard shortcuts

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