changes

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 13 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 changes compares the record in the working tree with the record on the configured branch: what `archdoc changes` lists, and what the rules lint runs on a pull request judge. Nothing here prints.

Index

Constants

View Source
const (
	Arrives = "arrives"
	Status  = "status"
	Edited  = "edited"
	Removed = "removed"
)

The changes a document can have.

Variables

View Source
var ErrNoBase = errors.New("no branch to compare against")

ErrNoBase reports that there is no configured branch to compare against, which is a usage error rather than a finding: there is nothing to judge.

Functions

func Differing

func Differing(g git.Repository, rev, revRoot, root string, docPaths []string) (map[string]bool, error)

Differing names which of docPaths, paths within a root, differ between rev, whose documents live under revRoot, and the working tree, whose live under root, as git judges it. A document absent from rev differs.

func NoSharedHistory

func NoSharedHistory(branch string) string

NoSharedHistory says HEAD and branch share no commit, formatted with the branch. actions/checkout fetches a depth of one by default, which holds HEAD alone and is the usual way to arrive here.

func Within

func Within(file, root string) (string, bool)

Within is file as a path inside root, both from the top level.

Types

type Base

type Base struct {
	Branch string
	// Commit is the merge base of HEAD and Branch, which is what is read.
	Commit string
	// Root is where the documents live on the base, as a path from the
	// repository's top level, which a pull request moving the root changes.
	Root string
	// Documents is every document on the branch, by path relative to root.
	Documents map[string]*repo.Document
	// Strict is the branch's own setting, so that a pull request cannot relax
	// the rule it is judged by, or the working tree's where the branch holds no
	// archdoc.json, as before the first pull request that adds one, or one that
	// cannot be read.
	Strict bool
}

Base is the record on the configured branch as HEAD last took it in: the commit GitHub merged a pull request against, or the point an unrebased branch was cut from, so that what the branch merged since is not read as removed.

func ReadBase

func ReadBase(r *repo.Repo, g git.Repository) (*Base, error)

ReadBase reads every document at the merge base of HEAD and the configured branch, and its strict, in one batch.

type Change

type Change struct {
	Type   repo.Type   `json:"type"`
	ID     string      `json:"id,omitempty"`
	Path   string      `json:"path"`
	Title  string      `json:"title,omitempty"`
	Change string      `json:"change"`
	From   repo.Status `json:"from,omitempty"`
	To     repo.Status `json:"to,omitempty"`
	// Terminal is set on an edit to an RFC or ADR only: whether the document
	// was terminal on the base, which L11 reports.
	Terminal *bool `json:"terminal,omitempty"`
	// contains filtered or unexported fields
}

Change is one document the working tree changes against the base.

func Of

func Of(r *repo.Repo, g git.Repository, base *Base) ([]Change, error)

Of lists what the working tree changes against base. A rename is a removal and an arrival, as L11 treats it.

type Located

type Located struct {
	config.Settings
	Root string
	// Unreadable is why the revision's archdoc.json could not be read, where
	// it could not, and the working tree's settings stand in for it. It is not
	// an error: a pull request mending the branch's file could never pass.
	Unreadable error
}

Located is the record as a revision holds it: the settings its archdoc.json gives, and its root as a path from the repository's top level.

func Locate

func Locate(r *repo.Repo, g git.Repository, rev string) (Located, error)

Locate reads the settings rev holds: from its archdoc.json at the working tree's location, or failing that from the one the working tree's moved from, so that a pull request moving the file is still judged by the base's strict and followed to the base's root. Where rev holds neither, as before the pull request that adds ArchDoc, the working tree's own settings stand.

Jump to

Keyboard shortcuts

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