~/bend-docscommunity

src/relock/relock.bend checks

raw source on the hub · import ezx@1.18.0.0/src/relock/relock.bend as Relock

relock: what ez add and ez remove share to leave the lock in step with the ledger they write (laws/AddRemoveRelock.bend). Each command plans its edit as before; then the plain ez lock planner (lock/plan.bend) is run over the World the edit leaves: the ledger the edit writes to ez.toml, the .bend files git lists, and the answers to the lock's questions. The two plans become one: the edit's effects, then the lines a person is told about the lock, then the lock's effects, which write ez.lock.toml last. A lock that refuses refuses the whole command, with no effect at all, so neither file changes.

A plain lock moves no pin (laws/PlainLockKeepsLedger.bend), so every dependency and tool the edit did not touch keeps the pin it had, and only what the edit changed is read anew.

3 imports
import Base
import ../lock/plan.bend as P
import ../lock/world.bend as W

Definitions

def toml source · line 19 · raw

String

the ledger's path, which is fixed

def ledger.of source · line 23 · raw

@wrote:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Wrote -> @was:Maybe<&2, String> -> Maybe<&2, String>

what ez.toml holds once a plan has run, when it held was before

def ledger source · line 31 · raw

@pl:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> @was:Maybe<&2, String> -> Maybe<&2, String>

the ledger an edit leaves, when ez.toml held was before it

def world source · line 36 · raw

@+here:String -> @ledger:Maybe<&2, String> -> @listing:0x2414c9622cab2353684d02a392804eb1/src/lock/world.Listing -> @rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply> -> 0x2414c9622cab2353684d02a392804eb1/src/lock/world.World

the World a plain ez lock reads, run in here over a ledger, the .bend files git lists, and the answers it was given. It asks the upgrade nothing.

def outcome source · line 40 · raw

@pl:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Outcome

how a plan ends

def refuses source · line 45 · raw

@pl:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> Bool

whether a plan ends in a refusal

def join.lock source · line 56 · raw

@lock:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> @+edit:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> @notes:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect> -> @+tail:String -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

the edit and the lock as one plan, once the edit is known to succeed: the edit's effects, the notes, and the lock's effects, or, when the lock refuses, a refusal with no effect, its reason followed by tail

def join.edit source · line 65 · raw

@refused:Bool -> @+edit:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> @lock:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> @notes:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect> -> @+tail:String -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

def join source · line 74 · raw

@+edit:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> @lock:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> @notes:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect> -> @+tail:String -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

an edit followed by the lock over what it leaves. An edit that refuses is the plan, with no effect; one that succeeds is joined to the lock.

def asks source · line 79 · raw

@st:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Step -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Ask>

what the lock still asks, as one list: the packages, then the names. A plain lock asks the upgrade nothing.