Merge pull request #5426 from ynx0/claybel

clay: support labels
This commit is contained in:
Philip Monk 2021-11-15 08:49:31 -08:00 committed by GitHub
commit 4656372b09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 7 deletions

View File

@ -8,7 +8,13 @@
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=[syd=desk lab=@tas ~] ~]
[arg=[syd=desk lab=@tas ~] aeon=aeon:clay ~]
==
:: handle optional aeon
::
=/ aey=(unit aeon:clay)
?: =(0 aeon)
~
`aeon
:- %kiln-label
[syd lab]:arg
[syd.arg lab.arg aey]

View File

@ -1207,9 +1207,9 @@
abet:abet:(install:vats +<)
::
++ poke-label
|= [syd=desk lab=@tas]
|= [syd=desk lab=@tas aey=(unit aeon)]
=+ pax=/(scot %p our)/[syd]/[lab]
(poke-info "labeled {(spud pax)}" `[syd %| lab])
(poke-info "labeled {(spud pax)}" `[syd %| lab aey])
::
++ poke-merge
|= kiln-merge

View File

@ -850,7 +850,7 @@
+$ mool [=case paths=(set (pair care path))] :: requests in desk
+$ nori :: repository action
$% [%& p=soba] :: delta
[%| p=@tas] :: label
[%| p=@tas q=(unit aeon)] :: label
== ::
+$ nuri :: repository action
$% [%& p=suba] :: delta

View File

@ -1445,6 +1445,32 @@
==
==
::
:: Attach label to aeon
::
++ label
|= [bel=@tas aey=(unit aeon)]
^+ ..park
=/ yon ?~(aey let.dom u.aey)
=/ yen (~(get by lab.dom) bel) :: existing aeon?
:: no existing aeon is bound to this label
::
?~ yen
=. lab.dom (~(put by lab.dom) bel yon)
..park
:: an aeon is bound to this label,
:: but it is the same as the existing one, so we no-op
::
?: =(u.yen yon)
~& "clay: tried to rebind existing label {<bel>} to equivalent aeon {<yon>}"
..park
:: an existing aeon bound to the label
:: that is distinct from the requested one.
:: rewriting would violate referential transparency
::
~| %tried-to-rewrite-existing-label
~| "requested aeon: {<yon>}, existing aeon: {<u.yen>}"
!!
::
:: Porcelain commit
::
++ info
@ -4374,8 +4400,12 @@
::
%info
?: ?=(%| -.dit.req)
~| %labelling-not-implemented
!!
=/ bel=@tas p.dit.req
=/ aey=(unit aeon) q.dit.req
=^ mos ruf
=/ den ((de now rof hen ruf) our des.req)
abet:(label:den bel aey)
[mos ..^$]
=/ [deletes=(set path) changes=(map path cage)]
=/ =soba p.dit.req
=| deletes=(set path)