vcs

package
v12.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfoStore

type InfoStore struct {
	OriginsByPackage map[string]OriginInfoByURL
	FilePath         string
	CmdBuilder       exe.GitCmdBuilder
	// contains filtered or unexported fields
}

InfoStore is a collection of OriginInfoByURL by Package. Containing a map of last commit SHAs of a repo.

func NewInfoStore

func NewInfoStore(filePath string, cmdBuilder exe.GitCmdBuilder,
	logger *text.Logger,
) *InfoStore

func (*InfoStore) CleanOrphans

func (v *InfoStore) CleanOrphans(pkgs map[string]alpm.IPackage)

func (*InfoStore) Load

func (v *InfoStore) Load() error

LoadStore reads a json file and populates a InfoStore structure.

func (*InfoStore) RemovePackages

func (v *InfoStore) RemovePackages(pkgs []string)

RemovePackage removes package from VCS information.

func (*InfoStore) Save

func (v *InfoStore) Save() error

func (*InfoStore) ToUpgrade

func (v *InfoStore) ToUpgrade(ctx context.Context, pkgName string) bool

func (*InfoStore) Update

func (v *InfoStore) Update(ctx context.Context, pkgName string, sources []gosrc.ArchString)

type Mock

type Mock struct {
	OriginsByPackage map[string]OriginInfoByURL
	ToUpgradeReturn  []string
}

func (*Mock) CleanOrphans

func (m *Mock) CleanOrphans(pkgs map[string]alpm.IPackage)

func (*Mock) Load

func (m *Mock) Load() error

func (*Mock) RemovePackages

func (m *Mock) RemovePackages(pkgs []string)

func (*Mock) Save

func (m *Mock) Save() error

func (*Mock) ToUpgrade

func (m *Mock) ToUpgrade(ctx context.Context, pkgName string) bool

func (*Mock) Update

func (m *Mock) Update(ctx context.Context, pkgName string, sources []gosrc.ArchString)

type OriginInfo

type OriginInfo struct {
	Protocols []string `json:"protocols"`
	Branch    string   `json:"branch"`
	SHA       string   `json:"sha"`
}

OriginInfo contains the last commit sha of a repo Example:

"github.com/Jguer/yay.git": {
	"protocols": [
		"https"
	],
	"branch": "next",
	"sha": "c1171d41467c68ffd3c46748182a16366aaaf87b"
}.

type OriginInfoByURL

type OriginInfoByURL map[string]OriginInfo

OriginInfoByURL stores the OriginInfo of each origin URL provided.

type Store

type Store interface {
	// ToUpgrade returns true if the package needs to be updated.
	ToUpgrade(ctx context.Context, pkgName string) bool
	// Update updates the VCS info of a package.
	Update(ctx context.Context, pkgName string, sources []gosrc.ArchString)
	// RemovePackages removes the VCS info of the packages given as arg if they exist.
	RemovePackages(pkgs []string)
	// Clean orphaned VCS info.
	CleanOrphans(pkgs map[string]alpm.IPackage)
	// Load loads the VCS info from disk.
	Load() error
	// Save saves the VCS info to disk.
	Save() error
}

Jump to

Keyboard shortcuts

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