Help us shape the future of Go! Take the 2026 Go Developer Survey

path

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoPath = errors.New("no path found")

ErrNoPath is returned when no path exists between the two nodes.

Functions

func NameChanges added in v0.14.0

func NameChanges(q db.Querier, from, to libfossil.FslID) (map[string]string, error)

NameChanges is fossil's find_filename_changes (src/path.c) with revOK set, as its update calls it: the files renamed between check-ins from and to, old name to new name. The path is the one path_shortest finds over primary links: up from from through primary parents to the nearest ancestor of to, then down through primary children. A rename on the way up is taken backwards; a file deleted on the way drops out. With no path between them there are no renames.

Types

type NameChange added in v0.15.0

type NameChange struct {
	From, To string
}

NameChange is one file renamed between two check-ins: its name in the first and its name in the second.

func FilenameChanges added in v0.15.0

func FilenameChanges(q db.Querier, from, to libfossil.FslID, revOK bool) ([]NameChange, error)

FilenameChanges is fossil's find_filename_changes (src/path.c): the files renamed between check-ins from and to, in the order fossil lists them, the most recently followed first. Without revOK the path only goes down primary links, as find_filename_changes' one-way path_shortest does, so from must be a primary ancestor of to or there are no changes; with it the path is NameChanges'.

type PathNode

type PathNode struct {
	RID   libfossil.FslID
	From  *PathNode
	Depth int
}

PathNode represents a single node in a path through the plink DAG.

func Shortest

func Shortest(db *sql.DB, from, to libfossil.FslID, directOnly bool, skip map[libfossil.FslID]bool) ([]PathNode, error)

Shortest finds the shortest path from `from` to `to` in the plink DAG using BFS. If directOnly is true, only primary parent edges (isprim=1) are traversed. Nodes in the skip set are not visited.

Jump to

Keyboard shortcuts

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