def answer.tree

ezx@1.11.0.0 · src/lock/run.bend:359

import ezx@1.11.0.0/src/lock/run.bend as Run
import Base
import snap@1.4.0.0/main.bend as R
import ezx@1.11.0.0/src/git/git.bend as Git
import ezx@1.11.0.0/src/git/exec.bend as GX
import ezx@1.11.0.0/src/pkg/path.bend as P
import ezx@1.11.0.0/src/share/say.bend as Say
import ezx@1.11.0.0/src/share/spin.bend as Spin
import ezx@1.11.0.0/src/lock/up.bend as Up

359# a checkout at a rev: cloned, its `.git` removed, weighed, and walked. An
360# entry that was not recorded is read from the checkout. Nothing is laid and
361# nothing is noted: a tree the upgrade moves to is laid by the plan, once the
362# upgrade and the lock both succeed.
363def answer.tree(+lib: String, +url: String, +rev: String, +entry: String) -> IO(Up.Answer):
364  +work = lib ++ "/.work-" ++ rev
365  do IO<Up.Answer>:
366    _rm : String <- R.exec(["rm", "-rf", work])
367    _mk : String <- R.exec(["mkdir", "-p", work])
368    GX.clone(work, url, rev)
369    +at : String <- Git.entry.for(Bool.not(String.is_empty(entry)), entry, work)
370    _dg : String <- R.exec(["rm", "-rf", work ++ "/.git"])
371    +s : Say.Spin <- Spin.hold(Say.hashing(rev))
372    +nar : String <- GX.nar(work)
373    Spin.done(s)
374    +ck : String <- R.exec(["test", "-f", P.join(work, at)])
375    tree.entry(R.ok(ck), work, at, url, rev, nar)

Uses (20)

Used by (1)