src/ws/moved.bend checks
raw source on the hub · import ezx@1.14.0.0/src/ws/moved.bend as Moved
ws/moved: a workspace member imported by its hash, once its hash moved
(laws/HashedMemberMovesCascade.bend). A member that publishes under no
name is imported by its 0x hash, and editing it moves that hash, so an
import line written before the edit names the hash the lock being
rewritten records for it. A plain lock writes no source
(laws/PlainLockKeepsLedger.bend), so it refuses, before it asks anything,
and names the upgrade that rewrites the line. That upgrade rewrites every
line naming a moved member's recorded hash, the way an upgrade rewrites a
moved dependency's (laws/UpgradeRewritesImports.bend,
laws/RewriteKeepsOtherLines.bend), and since a member whose files it
rewrote has a new hash in turn, it goes round again until no member it
moves moves any further. Everything here is pure: ws/up.bend plans with
it.
9 imports
import Base import ../ledger/manifest.bend as M import ../ledger/upgrade.bend as U import ../lock/lock.bend as L import ../lock/world.bend as LW import ../lock/plan.bend as LP import ../pkg/pkg.bend as K import ../toml/toml.bend as T import ./joint.bend as J
Types
type Held source · line 27 · raw
Data
a member's package: the directory it is written from, the name the joint ledger gives it ("" where the lock is read, which records none), and its hash
Held@path:String -> @name:String -> @hash:String -> Held
type Shift source · line 32 · raw
Data
a member whose hash moves: its name, the hash the lock records, and the hash it has now
Shift@name:String -> @old:String -> @new:String -> Shift
type Ctx source · line 260 · raw
Data
what a round of the upgrade sees: the root's ledger text, every other
ez.toml git lists, the committed files as they are, the members the lock
records, the members before any line was rewritten, and --package
Ctx@text:String -> @found:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/ws/joint.Found> -> @files:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/pkg/pkg.Source> -> @old:List<&2, Held> -> @base:List<&2, Held> -> @only:String -> Ctx
Definitions
def locked.src source · line 39 · raw
@src:0xe21073738926f8a159714d5cdaf60edb/src/lock/lock.Src -> @+hash:String -> List<&2, Held>
a package of the lock being rewritten, when it is a member's
def locked.all source · line 49 · raw
@ps:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/lock/lock.Pack> -> List<&2, Held>
every member package of a lock's packages
def locked source · line 57 · raw
@+text:String -> List<&2, Held>
every member package the lock being rewritten records, from its text
def now.src source · line 61 · raw
@src:0xe21073738926f8a159714d5cdaf60edb/src/ledger/manifest.Source -> @+name:String -> @+hash:String -> List<&2, Held>
a dependency of the joint ledger, when it is a member's
def now.all source · line 71 · raw
@ds:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/ledger/manifest.Dep> -> List<&2, Held>
every member the joint ledger depends on
def now source · line 79 · raw
@jj:0xe21073738926f8a159714d5cdaf60edb/src/ws/joint.Joint -> List<&2, Held>
every member the joint ledger depends on, or none when there is none
def held.path source · line 89 · raw
@hd:Held -> String
the directory a member is written from
def at.pick source · line 94 · raw
@hit:Bool -> @hd:Held -> @rest:Maybe<&2, Held> -> Maybe<&2, Held>
the member written from a directory, once it is known whether the head is
def at source · line 102 · raw
@hs:List<&2, Held> -> @+path:String -> Maybe<&2, Held>
the first member written from a directory, or none
def hash.of source · line 111 · raw
@found:Maybe<&2, Held> -> String
a member's hash, or "" for none
def move.put source · line 123 · raw
@hit:Bool -> @+name:String -> @+old:String -> @+new:String -> @rest:List<&2, Shift> -> List<&2, Shift>
a move kept, once it is known whether it is one
def move.found source · line 135 · raw
@found:Maybe<&2, Held> -> @+base:String -> @+old:String -> @+only:String -> @rest:List<&2, Shift> -> List<&2, Shift>
the member the lock records at a directory, against what it is now: it
moves when its hash is not the one the lock records, and it is chosen
(--package, or every member when none is given) or its hash is not the
one it had before any line was rewritten, which is a member whose files
the upgrade rewrote
def moves source · line 152 · raw
@old:List<&2, Held> -> @+now:List<&2, Held> -> @+base:List<&2, Held> -> @+only:String -> List<&2, Shift>
every member the lock records that moves: now the members as they are,
base as they were before any line was rewritten
def swaps source · line 166 · raw
@ms:List<&2, Shift> -> List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/ledger/upgrade.Swap>
the moves as the rewrites they make
def rewrite source · line 174 · raw
@+ss:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/ledger/upgrade.Swap> -> @fs:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/pkg/pkg.Source> -> List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/pkg/pkg.Source>
every committed file with every moved hash rewritten
def stale.moves source · line 185 · raw
@ms:List<&2, Shift> -> @+at:String -> @+text:String -> String
why a file stops a plain lock: the first move one of its lines names
def stale source · line 198 · raw
@+ms:List<&2, Shift> -> @fs:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/pkg/pkg.Source> -> String
why a plain lock refuses: the first committed file with a line naming a moved member's recorded hash, "" when none does
def now.read source · line 208 · raw
@rd:0xe21073738926f8a159714d5cdaf60edb/src/ledger/manifest.Read -> List<&2, Held>
the members of a ledger's text, as the joint ledger renders them
def now.ledger source · line 216 · raw
@ledger:Maybe<&2, String> -> List<&2, Held>
and of the World's ledger
def moved source · line 225 · raw
@+lock:String -> @ledger:Maybe<&2, String> -> List<&2, Shift>
every member that moved since the lock being rewritten, against the joint ledger the lock is planned from
def stale.world source · line 231 · raw
@+lock:String -> @world:0xe21073738926f8a159714d5cdaf60edb/src/lock/world.World -> String
why a plain lock at a workspace root refuses before it asks anything, "" when it does not
def move.eq source · line 239 · raw
@aa:Shift -> @bb:Shift -> Bool
whether two moves are one
def moves.eq source · line 245 · raw
@aa:List<&2, Shift> -> @bb:List<&2, Shift> -> Bool
whether two lists of moves are one
def round source · line 266 · raw
@ctx:Ctx -> @ms:List<&2, Shift> -> List<&2, Shift>
the moves the next round makes: the files rewritten with this round's moves, the members walked again over them, and the moves against those
def cascade.pick source · line 272 · raw
@same:Bool -> @ms:List<&2, Shift> -> @rest:(@_:Unit -> List<&2, Shift>) -> List<&2, Shift>
the moves once a round is known to change them or not; the rounds after it arrive as a thunk, so the rounds stop where the moves do
def cascade.go source · line 280 · raw
@fuel:Nat -> @+ctx:Ctx -> @+ms:List<&2, Shift> -> List<&2, Shift>
rounds, under fuel, until one moves no member further
def ctx source · line 289 · raw
@+text:String -> @+fs:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/ws/joint.Found> -> @+files:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/pkg/pkg.Source> -> @+lock:String -> @+only:String -> Ctx
the context of an upgrade's rounds
def cascade source · line 295 · raw
@+cx:Ctx -> List<&2, Shift>
the members the upgrade moves, from the ones it is asked to. Each round moves at least one more member or ends, and a member moves once, so a round per member the lock records and one more is fuel enough.
def edit.put source · line 301 · raw
@changed:Bool -> @+at:String -> @text:String -> @+rest:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/lock/plan.Effect> -> List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/lock/plan.Effect>
a rewritten file written, when the rewrite changed it and it is not the lock
def edits source · line 309 · raw
@+ss:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/ledger/upgrade.Swap> -> @fs:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/pkg/pkg.Source> -> List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/lock/plan.Effect>
every file the moves rewrite, written
def sources source · line 318 · raw
@fs:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/pkg/pkg.Source> -> List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/lock/world.Source>
the committed files as the lock is to read them
def world.moved source · line 328 · raw
@+jj:0xe21073738926f8a159714d5cdaf60edb/src/ws/joint.Joint -> @+files:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/pkg/pkg.Source> -> @world:0xe21073738926f8a159714d5cdaf60edb/src/lock/world.World -> 0xe21073738926f8a159714d5cdaf60edb/src/lock/world.World
the World the upgrade plans on: the committed files rewritten with every move, and the joint ledger and the answers for its members made again over them, so the lock walks the members as the rewrite leaves them