~/bend-docscommunity

src/lock/up.bend fails

raw source on the hub · import ezx@1.11.0.0/src/lock/up.bend as Up

lock/up: what ez lock --upgrade decides, as a pure function of what the remote said. It is the upgrade half of the planner (lock/plan.bend): it reads the ledger and the answers to its own questions, and returns either the questions it still has, a refusal, or the ledger the lock is made from and everything the upgrade writes around it. The interpreter (lock/run.bend) answers each question by IO, and the planner turns the result into effects.

A git dependency with a tag is re-resolved to that tag; one with only a commit fast-forwards to the default branch tip when the pin is an ancestor of it. A hub dependency is left, because the hash is the pin. --package selects one dependency or tool, and no other entry is asked about. A tool pin with no commit or no NAR hash is filled here and nowhere else. A moved dependency marked vendor = true has its new tree committed under .ez/lib and its old one removed, the gitignore allowlist is derived again from the ledger the upgrade leaves (I.sync), and an import that names a moved hash is rewritten. Nothing is written when the upgrade refuses: that is the planner's, since a refusal is a plan with no effects.

A same commit is checked out and weighed, and U.judge is given whether that checkout agrees with the pin, so a pinned commit whose tree no longer hashes to the pin is Drift and refused.

12 imports
import Base
import ./lock.bend as L
import ../ledger/manifest.bend as M
import ../ledger/render.bend as Rend
import ../ledger/upgrade.bend as U
import ../ledger/ignore.bend as I
import ../git/git.bend as Git
import ../pkg/pkg.bend as K
import ../pkg/path.bend as Path
import ../hub/hub.bend as Web
import ../share/sha.bend as Sha
import ../share/say.bend as Say