~/bend-docscommunity

src/ws/relock.bend checks

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

ws/relock: ez add and ez remove in a workspace (laws/WorkspaceAddRemoveRelock.bend). Outside a workspace each runs its command's plan joined to a plain lock over the ledger it writes (add/relock.bend, remove/relock.bend, laws/AddRemoveRelock.bend). In a workspace the lock that ledger belongs to is the root's, so the command's own plan is joined instead to the plan a plain ez lock at the root makes (U.plan, ws/up.bend) over the workspace the command leaves: the root's ledger and every member's as git lists them, with the one the command writes in place of its own, joined (ws/joint.bend), the .bend files git lists under the root, and the lock's answers. The command runs where it is, so every path that lock writes is taken from the root's directory (at.effect), and no lock is written in a member.

A ledger the add or remove writes at the root is written through the ledger model, which holds no [workspace] table, so it is written back with the table it had (U.root.text), as an upgrade writes the root's.

16 imports
import Base
import ../lock/plan.bend as LP
import ../lock/world.bend as LW
import ../lock/lock.bend as L
import ../ledger/manifest.bend as M
import ../ledger/render.bend as Rend
import ../pkg/path.bend as P
import ../relock/relock.bend as R
import ../add/world.bend as A
import ../add/plan.bend as AP
import ../add/relock.bend as AR
import ../remove/plan.bend as RP
import ../remove/relock.bend as RR
import ./workspace.bend as W
import ./joint.bend as J
import ./up.bend as U

Types

type Rooted source · line 38 · raw

Data

what a command run in a workspace reads of its root: the root's directory, the path from it to where the command runs, the root's ledger, every other ez.toml git lists under it, the .bend files git lists under it, each path from the root, and the root's lock

type Ws source · line 49 · raw

Data

where a command runs: in a project of its own, or in a workspace

type Ledgers source · line 179 · raw

Data

the root's ledger and every other ez.toml git lists under the root

type Lock source · line 228 · raw

Data

the lock at the root, as a plain ez lock there plans it: what its upgrade half needs and the World it reads, or why the ledgers cannot be joined

Definitions

def rooted.at source · line 54 · raw

@root:Rooted -> String

the root's directory

def at.place source · line 64 · raw

@+at:String -> @place:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Place -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Place

a place a tree is laid in, taken from the root: the root's committed .ez/lib for a committed tree, BEND_LIB as it is, and a directory under the root from the root

def at.effect source · line 76 · raw

@+at:String -> @effect:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect

an effect of the root's lock as it is run from where the command runs: every path it writes taken from the root. Removing a committed tree is laying it with no file, which removes what was there and writes nothing.

def at.effects source · line 90 · raw

@+at:String -> @es:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect> -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect>

every effect of the root's lock, so

def at.plan source · line 98 · raw

@+at:String -> @pl:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

the root's lock plan, so

def keep.parsed source · line 107 · raw

@rd:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Read -> @+spec:0x2414c9622cab2353684d02a392804eb1/src/ws/workspace.Spec -> @root:0x2414c9622cab2353684d02a392804eb1/src/ws/workspace.Root -> @+text:String -> String

a ledger the command writes at the root, once it is read: as the root's with the table it had, or as it is when it does not read

def keep.read source · line 116 · raw

@rd:0x2414c9622cab2353684d02a392804eb1/src/ws/workspace.Read -> @+old:String -> @+text:String -> String

once it is known whether the root's ledger, old, had a [workspace] table

def keep source · line 126 · raw

@+old:String -> @+text:String -> String

the text a command writes as the root's ledger, which held old

def keep.write source · line 130 · raw

@hit:Bool -> @+old:String -> @+path:String -> @+text:String -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect

a file the command writes, once it is known whether it is the ledger

def keep.effect source · line 138 · raw

@+old:String -> @effect:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect

an effect of the command at the root, its ledger keeping its table

def keep.effects source · line 152 · raw

@+old:String -> @es:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect> -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect>

every effect of the command at the root, so

def edit.at source · line 162 · raw

@rel:List<&2, String> -> @+old:String -> @pl:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

the command's own plan, run at the path rel from the root, whose ledger is old: at the root, with the root's ledger keeping its table, and in a member as it is

def edit source · line 171 · raw

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

the command's own plan, in the workspace

def put.pick source · line 183 · raw

@hit:Bool -> @+path:String -> @was:String -> @+text:String -> @rest:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/ws/joint.Found> -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/ws/joint.Found>

a listed ez.toml, once it is known whether it is the one the command writes

def put.found source · line 191 · raw

@fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/ws/joint.Found> -> @+path:String -> @+text:String -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/ws/joint.Found>

every listed ez.toml, the one at path holding text

def ledgers.at source · line 201 · raw

@rel:List<&2, String> -> @+new:String -> @+text:String -> @+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/ws/joint.Found> -> Ledgers

the ledgers once the command at rel writes new: the root's, at the root, or the member's ez.toml under it

def new.of source · line 210 · raw

@led:Maybe<&2, String> -> String

the ledger's text the command leaves, "" when it leaves none, which only a command that refuses does

def ledgers source · line 219 · raw

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

the ledgers the command leaves, when its own plan, as the workspace runs it, is pl and its ledger held was before

def world source · line 233 · raw

@+at:String -> @led: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 at the root

def lock.joint source · line 238 · raw

@jj:0x2414c9622cab2353684d02a392804eb1/src/ws/joint.Joint -> @+at:String -> @+text:String -> @+spec:0x2414c9622cab2353684d02a392804eb1/src/ws/workspace.Spec -> @+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/ws/joint.Found> -> @+listing:0x2414c9622cab2353684d02a392804eb1/src/lock/world.Listing -> @+lock:String -> @rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply> -> Lock

the lock, once the ledgers were joined: as ez lock at the root reads it (ws/run.bend's joint.at), with the members' answers first

def lock.read source · line 259 · raw

@rd:0x2414c9622cab2353684d02a392804eb1/src/ws/workspace.Read -> @+at:String -> @+text:String -> @+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/ws/joint.Found> -> @+listing:0x2414c9622cab2353684d02a392804eb1/src/lock/world.Listing -> @+lock:String -> @rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply> -> Lock

the lock, once the root's ledger is read

def lock.of source · line 277 · raw

@lg:Ledgers -> @root:Rooted -> @rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply> -> Lock

the lock at the root over the ledgers the command leaves

def stop source · line 283 · raw

@+why:String -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

a refusal, with no effect

def lock.plan source · line 287 · raw

@lk:Lock -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

the lock's plan

def lock.step source · line 295 · raw

@lk:Lock -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Step

the lock's step

def lock.packs source · line 303 · raw

@lk:Lock -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/lock.Pack>

the packages the lock records, none when it cannot be made

def add.edit source · line 314 · raw

@+root:Rooted -> @+aw:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

the add's own plan, as the workspace runs it

def add.lock source · line 319 · raw

@+root:Rooted -> @world:0x2414c9622cab2353684d02a392804eb1/src/add/relock.World -> Lock

the root's lock over what the add leaves, with the answers the add has for it first

def add.notes source · line 325 · raw

@+lk:Lock -> @+aw:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect>

the note (laws/AddNotesUnlockedPackage.bend), over the root's lock

def add.plan source · line 330 · raw

@+root:Rooted -> @world:0x2414c9622cab2353684d02a392804eb1/src/add/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

ez add in a workspace: the add, then the root's lock over what it leaves, run from where the add runs

def add.next.lock source · line 336 · raw

@st:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Step -> @+root:Rooted -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/add/relock.Next

the lock's step, once the add is planned and succeeds

def add.next.made source · line 344 · raw

@refused:Bool -> @+root:Rooted -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/add/relock.Next

the add's plan made: refused, it is the plan; otherwise the lock is next

def add.next.add source · line 352 · raw

@nx:0x2414c9622cab2353684d02a392804eb1/src/add/plan.Next -> @+root:Rooted -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/add/relock.Next

the add's own step: its questions, or its plan made

def add.next source · line 363 · raw

@ws:Ws -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/add/relock.Next

what the interpreter does next for ez add: in a project of its own, what add/relock.bend says; in a workspace, the add, then the root's lock

def add.planned source · line 371 · raw

@ws:Ws -> @world:0x2414c9622cab2353684d02a392804eb1/src/add/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

ez add's plan, wherever it runs

def remove.edit source · line 382 · raw

@+root:Rooted -> @+rw:0x2414c9622cab2353684d02a392804eb1/src/remove/plan.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

the remove's own plan, as the workspace runs it

def remove.lock source · line 386 · raw

@+root:Rooted -> @world:0x2414c9622cab2353684d02a392804eb1/src/remove/relock.World -> Lock

the root's lock over what the remove leaves

def remove.plan source · line 392 · raw

@+root:Rooted -> @world:0x2414c9622cab2353684d02a392804eb1/src/remove/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

ez remove in a workspace: the remove, then the root's lock over what it leaves, run from where the remove runs

def remove.next.lock source · line 398 · raw

@st:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Step -> @+root:Rooted -> @+world:0x2414c9622cab2353684d02a392804eb1/src/remove/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/remove/relock.Next

the lock's step, once the remove succeeds

def remove.next.made source · line 406 · raw

@refused:Bool -> @+root:Rooted -> @+world:0x2414c9622cab2353684d02a392804eb1/src/remove/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/remove/relock.Next

the remove refused is the plan; otherwise the lock is next

def remove.next source · line 416 · raw

@ws:Ws -> @+world:0x2414c9622cab2353684d02a392804eb1/src/remove/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/remove/relock.Next

what the interpreter does next for ez remove: in a project of its own, what remove/relock.bend says; in a workspace, the remove, then the root's lock

def remove.planned source · line 424 · raw

@ws:Ws -> @world:0x2414c9622cab2353684d02a392804eb1/src/remove/relock.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

ez remove's plan, wherever it runs