mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
clay: add -merge except meet/mate/meld
-merge will replace |merge so that. Once they reach feature parity and %info is rewritten to forward to -commit, we can rip out about half of clay.hoon
This commit is contained in:
parent
4d013573e1
commit
3f2a7b08a5
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4af34fec9a0a4a99b9c6294f8f1898dcfbdbb6b74a83ab77e2d49032532e53b2
|
||||
size 13112651
|
||||
oid sha256:cca578fefba7dba24856c63f9e907aee70505cf61a0fd404fb205575436be1a4
|
||||
size 13125460
|
||||
|
80
pkg/arvo/lib/clay-commit.hoon
Normal file
80
pkg/arvo/lib/clay-commit.hoon
Normal file
@ -0,0 +1,80 @@
|
||||
/- spider
|
||||
/+ strandio
|
||||
=, strand=strand:spider
|
||||
=, clay
|
||||
|%
|
||||
:: Produce an ankh
|
||||
::
|
||||
++ checkout
|
||||
|= [=ankh deletes=(set path) changes=(map path cage)]
|
||||
^- ^ankh
|
||||
:: Delete
|
||||
::
|
||||
=. ankh
|
||||
=/ dels ~(tap in deletes)
|
||||
|- ^- ^ankh
|
||||
=* outer-loop $
|
||||
?~ dels
|
||||
ankh
|
||||
=. ankh
|
||||
|- ^- ^ankh
|
||||
=* inner-loop $
|
||||
?~ i.dels
|
||||
ankh(fil ~)
|
||||
%= ankh
|
||||
dir
|
||||
%+ ~(put by dir.ankh) i.i.dels
|
||||
%= inner-loop
|
||||
i.dels t.i.dels
|
||||
ankh (~(gut by dir.ankh) i.i.dels *^ankh)
|
||||
==
|
||||
==
|
||||
outer-loop(dels t.dels)
|
||||
:: Add/change
|
||||
::
|
||||
=/ cans=(list [=path =cage]) ~(tap by changes)
|
||||
|- ^- ^ankh
|
||||
=* outer-loop $
|
||||
?~ cans
|
||||
ankh
|
||||
=. ankh
|
||||
=/ orig-path path.i.cans
|
||||
|- ^- ^ankh
|
||||
=* inner-loop $
|
||||
?~ path.i.cans
|
||||
%= ankh
|
||||
fil
|
||||
`[(page-to-lobe [p q.q]:cage.i.cans) cage.i.cans]
|
||||
==
|
||||
%= ankh
|
||||
dir
|
||||
%+ ~(put by dir.ankh) i.path.i.cans
|
||||
%= inner-loop
|
||||
path.i.cans t.path.i.cans
|
||||
ankh (~(gut by dir.ankh) i.path.i.cans *^ankh)
|
||||
==
|
||||
==
|
||||
outer-loop(cans t.cans)
|
||||
:: Produce a mime cache
|
||||
::
|
||||
++ checkout-cache
|
||||
|= [=desk deletes=(set path) changes=(map path cage)]
|
||||
=/ m (strand ,(map path (unit mime)))
|
||||
^- form:m
|
||||
;< our=@p bind:m get-our:strandio
|
||||
=/ mim-builds=(map path schematic:ford)
|
||||
%- ~(run by changes)
|
||||
|= =cage
|
||||
[%cast [our desk] %mime %$ cage]
|
||||
;< mim-results=(map path cage) bind:m (build-cages:strandio mim-builds)
|
||||
=/ can-mim=(map path (unit mime))
|
||||
%- ~(run by mim-results)
|
||||
|= =cage
|
||||
?> ?=(%mime p.cage)
|
||||
`!<(mime q.cage)
|
||||
=/ del-mim=(map path (unit mime))
|
||||
(malt (turn ~(tap in deletes) |=(=path [path ~])))
|
||||
=/ new-mim=(map path (unit mime))
|
||||
(~(uni by del-mim) can-mim)
|
||||
(pure:m new-mim)
|
||||
--
|
@ -492,6 +492,29 @@
|
||||
loop(results t.results)
|
||||
(pure:m produce)
|
||||
::
|
||||
:: Read from Clay
|
||||
::
|
||||
++ warp
|
||||
|= [=ship =riff:clay]
|
||||
=/ m (strand ,riot:clay)
|
||||
;< ~ bind:m (send-raw-card %pass /warp %arvo %c %warp ship riff)
|
||||
(take-writ /warp)
|
||||
::
|
||||
:: Take Clay read result
|
||||
::
|
||||
++ take-writ
|
||||
|= =wire
|
||||
=/ m (strand ,riot:clay)
|
||||
^- form:m
|
||||
|= tin=strand-input:strand
|
||||
?+ in.tin `[%skip ~]
|
||||
~ `[%wait ~]
|
||||
[~ %sign * %b %writ *]
|
||||
?. =(wire wire.u.in.tin)
|
||||
`[%skip ~]
|
||||
`[%done +>.sign-arvo.u.in.tin]
|
||||
==
|
||||
::
|
||||
:: Queue on skip, try next on fail %ignore
|
||||
::
|
||||
++ main-loop
|
||||
|
@ -705,7 +705,7 @@
|
||||
?: ?=(%unto +>-.gift)
|
||||
[+>-.gift (symp +>+<.gift)]
|
||||
(symp +>-.gift)
|
||||
duct
|
||||
duct.move
|
||||
::
|
||||
(take duct wire vane gift)
|
||||
::
|
||||
|
@ -1122,6 +1122,7 @@
|
||||
::
|
||||
=/ ford-disc=disc:ford
|
||||
?: =(p.ali-disc p.bob-disc)
|
||||
|
||||
ali-disc
|
||||
bob-disc
|
||||
|^
|
||||
@ -2943,7 +2944,6 @@
|
||||
::
|
||||
++ print
|
||||
^+ ..park
|
||||
~& > %print
|
||||
?~ hun
|
||||
..park
|
||||
%- emil
|
||||
@ -3922,17 +3922,22 @@
|
||||
?: =(%black mod.rul)
|
||||
!in-list
|
||||
in-list
|
||||
:: +read-s: produce yaki for given tako
|
||||
:: +read-s: produce yaki or blob for given tako or lobe
|
||||
::
|
||||
++ read-s
|
||||
|= [yon=aeon pax=path]
|
||||
^- (unit (unit [%yaki (hypo yaki)]))
|
||||
?. ?=([* ~] pax)
|
||||
^- (unit (unit $%([%yaki (hypo yaki)] [%blob (hypo blob)])))
|
||||
?. ?=([?(%yaki %blob) * ~] pax)
|
||||
`~
|
||||
=/ yak=(unit yaki) (~(get by hut.ran) (slav %uv i.pax))
|
||||
?~ yak
|
||||
?: ?=(%yaki i.pax)
|
||||
=/ yak=(unit yaki) (~(get by hut.ran) (slav %uv i.t.pax))
|
||||
?~ yak
|
||||
~
|
||||
``yaki+[-:!>(*yaki) u.yak]
|
||||
=/ bol=(unit blob) (~(get by lat.ran) (slav %uv i.t.pax))
|
||||
?~ bol
|
||||
~
|
||||
``yaki+`(hypo yaki)`[-:!>(*yaki) u.yak]
|
||||
``blob+[-:!>(*blob) u.bol]
|
||||
:: +read-t: produce the list of paths within a yaki with :pax as prefix
|
||||
::
|
||||
++ read-t
|
||||
|
@ -2341,7 +2341,7 @@
|
||||
$% {$a gift:able:ames}
|
||||
$: $b
|
||||
$% gift:able:behn
|
||||
[%writ riot:clay]
|
||||
[%writ p=riot:clay]
|
||||
$>(%mere gift:able:clay)
|
||||
$>(%unto gift:able:gall)
|
||||
==
|
||||
|
@ -2,7 +2,7 @@
|
||||
:: else.
|
||||
::
|
||||
/- spider
|
||||
/+ strandio
|
||||
/+ strandio, clay-commit
|
||||
=, strand=strand:spider
|
||||
=, clay
|
||||
^- thread:spider
|
||||
@ -35,8 +35,8 @@
|
||||
::
|
||||
=/ parent-tako=tako (~(got by hit.dome) let.dome)
|
||||
=/ all-lobes=(map path lobe)
|
||||
=+ .^ parent-yaki=yaki %cs
|
||||
/(scot %p our)/[desk]/(scot %da now)/(scot %uv parent-tako)
|
||||
=+ .^ =parent=yaki %cs
|
||||
/(scot %p our)/[desk]/(scot %da now)/yaki/(scot %uv parent-tako)
|
||||
==
|
||||
=/ after-deletes
|
||||
%- ~(dif by q.parent-yaki)
|
||||
@ -44,7 +44,7 @@
|
||||
%- ~(uni by after-deletes)
|
||||
(~(run by new-blobs) |=(=blob p.blob))
|
||||
::
|
||||
:: XX should we get getting the time later, after all async?
|
||||
:: XX should we be getting the time later, after all async?
|
||||
;< now=@da bind:m get-time:strandio
|
||||
=/ new-yaki=yaki (make-yaki ~[parent-tako] all-lobes now)
|
||||
::
|
||||
@ -54,72 +54,13 @@
|
||||
:- (~(put by hut:*rang) r.new-yaki new-yaki)
|
||||
(malt (turn ~(tap by new-blobs) |=([=path =blob] [p.blob blob])))
|
||||
::
|
||||
:: Checkout ankh
|
||||
::
|
||||
=/ =ankh ank.dome
|
||||
=. ankh
|
||||
=/ dels ~(tap in deletes)
|
||||
|- ^- ^ankh
|
||||
=* outer-loop $
|
||||
?~ dels
|
||||
ankh
|
||||
|- ^- ^ankh
|
||||
=* inner-loop $
|
||||
?~ i.dels
|
||||
outer-loop(dels t.dels, fil.ankh ~)
|
||||
%= ankh
|
||||
dir
|
||||
%+ ~(put by dir.ankh) i.i.dels
|
||||
%= inner-loop
|
||||
i.dels t.i.dels
|
||||
ankh (~(gut by dir.ankh) i.i.dels *^ankh)
|
||||
==
|
||||
==
|
||||
=. ankh
|
||||
=/ blobs=(list [=path =blob]) ~(tap by new-blobs)
|
||||
|- ^- ^ankh
|
||||
=* outer-loop $
|
||||
?~ blobs
|
||||
ankh
|
||||
=/ orig-path path.i.blobs
|
||||
|- ^- ^ankh
|
||||
=* inner-loop $
|
||||
?~ path.i.blobs
|
||||
%= outer-loop
|
||||
blobs t.blobs
|
||||
fil.ankh
|
||||
?> ?=(%direct -.blob.i.blobs)
|
||||
:+ ~ p.blob.i.blobs
|
||||
(~(got by cast-results) orig-path)
|
||||
==
|
||||
%= ankh
|
||||
dir
|
||||
%+ ~(put by dir.ankh) i.path.i.blobs
|
||||
%= inner-loop
|
||||
path.i.blobs t.path.i.blobs
|
||||
ankh (~(gut by dir.ankh) i.path.i.blobs *^ankh)
|
||||
==
|
||||
==
|
||||
::
|
||||
:: Checkout cache
|
||||
::
|
||||
=/ mim-builds=(map path schematic:ford)
|
||||
%- ~(run by cast-results)
|
||||
|= =cage
|
||||
[%cast [our desk] %mime %$ cage]
|
||||
;< mim-results=(map path cage) bind:m (build-cages:strandio mim-builds)
|
||||
=/ can-mim=(map path (unit mime))
|
||||
%- ~(run by mim-results)
|
||||
|= =cage
|
||||
?> ?=(%mime p.cage)
|
||||
`!<(mime q.cage)
|
||||
=/ del-mim=(map path (unit mime))
|
||||
(malt (turn ~(tap in deletes) |=(=path [path ~])))
|
||||
=/ new-mim=(map path (unit mime))
|
||||
(~(uni by del-mim) can-mim)
|
||||
:: Checkout ankh and mime cache (derived state)
|
||||
::
|
||||
=/ =ankh (checkout:clay-commit ank.dome deletes cast-results)
|
||||
;< mim=(map path (unit mime)) bind:m
|
||||
(checkout-cache:clay-commit desk deletes cast-results)
|
||||
:: Send to clay
|
||||
::
|
||||
=/ args [desk r.new-yaki rang ankh new-mim]
|
||||
=/ args [desk r.new-yaki rang ankh mim]
|
||||
;< ~ bind:m (send-raw-card:strandio %pass /commit/[desk] %arvo %c %park args)
|
||||
(pure:m !>(~))
|
||||
|
208
pkg/arvo/ted/merge.hoon
Normal file
208
pkg/arvo/ted/merge.hoon
Normal file
@ -0,0 +1,208 @@
|
||||
:: Merge second desk into first
|
||||
::
|
||||
/- spider
|
||||
/+ strandio, clay-commit
|
||||
=, strand=strand:spider
|
||||
=, clay
|
||||
^- thread:spider
|
||||
|= arg=vase
|
||||
=+ !<([=bob=desk =ali=ship =ali=desk =germ ~] arg)
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
;< our=@p bind:m get-our:strandio
|
||||
;< wen=@da bind:m get-time:strandio
|
||||
|^
|
||||
::
|
||||
:: Fetch current states
|
||||
::
|
||||
=/ start-path /(scot %p our)/[bob-desk]/(scot %da wen)
|
||||
;< =ali=riot:clay bind:m
|
||||
(warp:strandio ali-ship ali-desk `[%sing %v da+wen /])
|
||||
?> ?=(^ ali-riot)
|
||||
=+ !<(=ali=dome q.r.u.ali-riot)
|
||||
=/ ali-tako=tako (~(got by hit.ali-dome) let.ali-dome)
|
||||
=+ .^(=ali=yaki %cs (weld start-path /yaki/(scot %uv ali-tako)))
|
||||
=+ .^(=bob=dome %cv start-path)
|
||||
=/ bob-tako=tako (~(got by hit.bob-dome) let.bob-dome)
|
||||
=+ .^(=bob=yaki %cs (weld start-path /yaki/(scot %uv bob-tako)))
|
||||
::
|
||||
;< =merge-result bind:m (merge ali-yaki bob-yaki)
|
||||
?~ merge-result
|
||||
(pure:m !>(~))
|
||||
=/ =rang
|
||||
[(malt [r .]:new.u.merge-result ~) lat.u.merge-result]
|
||||
;< [=ankh changes=(map path cage)] bind:m
|
||||
(checkout bob-dome new.u.merge-result [deletes changes]:u.merge-result)
|
||||
;< mim=(map path (unit mime)) bind:m
|
||||
(checkout-cache:clay-commit bob-desk deletes.u.merge-result changes)
|
||||
=/ args [bob-desk r.new.u.merge-result rang ankh mim]
|
||||
;< ~ bind:m
|
||||
(send-raw-card:strandio %pass /merg/[bob-desk]/[ali-desk] %arvo %c %park args)
|
||||
(pure:m !>(~))
|
||||
::
|
||||
+$ merge-result
|
||||
%- unit
|
||||
$: conflicts=(set path)
|
||||
bop=(map path cage)
|
||||
new=yaki
|
||||
deletes=(set path)
|
||||
changes=(set path)
|
||||
lat=(map lobe blob)
|
||||
==
|
||||
++ merge
|
||||
|= [=ali=yaki =bob=yaki]
|
||||
|^
|
||||
=/ m (strand ,merge-result)
|
||||
^- form:m
|
||||
?- germ
|
||||
::
|
||||
:: If this is an %init merge, we set the ali's commit to be bob's.
|
||||
::
|
||||
%init
|
||||
%: pure:m
|
||||
~
|
||||
conflicts=~
|
||||
bop=~
|
||||
new=ali-yaki
|
||||
deletes=~
|
||||
changes=~(key by q.ali-yaki)
|
||||
lat=~
|
||||
==
|
||||
::
|
||||
:: If this is a %this merge, we check to see if ali's and bob's commits
|
||||
:: are the same, in which case we're done. Otherwise, we check to see
|
||||
:: if ali's commit is in the ancestry of bob's, in which case we're
|
||||
:: done. Otherwise, we create a new commit with bob's data plus ali
|
||||
:: and bob as parents.
|
||||
::
|
||||
%this
|
||||
?: =(r.ali-yaki r.bob-yaki)
|
||||
(pure:m ~)
|
||||
?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki)
|
||||
(pure:m ~)
|
||||
=/ new-yaki (make-yaki [r.bob-yaki r.ali-yaki ~] q.bob-yaki wen)
|
||||
%: pure:m
|
||||
~
|
||||
conflicts=~
|
||||
bop=~
|
||||
new=new-yaki
|
||||
deletes=~
|
||||
changes=~
|
||||
lat=~
|
||||
==
|
||||
::
|
||||
:: If this is a %that merge, we check to see if ali's and bob's commits
|
||||
:: are the same, in which case we're done. Otherwise, we create a new
|
||||
:: commit with ali's data plus ali and bob as parents.
|
||||
::
|
||||
%that
|
||||
?: =(r.ali-yaki r.bob-yaki)
|
||||
(pure:m ~)
|
||||
=/ new-yaki (make-yaki [r.bob-yaki r.ali-yaki ~] q.ali-yaki wen)
|
||||
%: pure:m
|
||||
~
|
||||
conflicts=~
|
||||
bop=~
|
||||
new=new-yaki
|
||||
deletes=get-deletes
|
||||
changes=get-changes
|
||||
lat=~
|
||||
==
|
||||
::
|
||||
:: If this is a %fine merge, we check to see if ali's and bob's commits
|
||||
:: are the same, in which case we're done. Otherwise, we check to see
|
||||
:: if ali's commit is in the ancestry of bob's, in which case we're
|
||||
:: done. Otherwise, we check to see if bob's commit is in the ancestry
|
||||
:: of ali's. If not, this is not a fast-forward merge, so we error
|
||||
:: out. If it is, we add ali's commit to bob's desk and checkout.
|
||||
::
|
||||
::
|
||||
%fine
|
||||
?: =(r.ali-yaki r.bob-yaki)
|
||||
(pure:m ~)
|
||||
?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki)
|
||||
(pure:m ~)
|
||||
?. (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki)
|
||||
(strand-fail:strandio %bad-fine-merge ~)
|
||||
%: pure:m
|
||||
~
|
||||
conflicts=~
|
||||
bop=~
|
||||
new=ali-yaki
|
||||
deletes=get-deletes
|
||||
changes=get-changes
|
||||
lat=~
|
||||
==
|
||||
::
|
||||
?(%meet %mate %meld)
|
||||
~& %merge-not-implemented
|
||||
!!
|
||||
==
|
||||
::
|
||||
++ reachable-takos
|
||||
|= tak=tako
|
||||
^- (set tako)
|
||||
=/ start-path /(scot %p our)/[bob-desk]/(scot %da wen)
|
||||
|- ^- (set tako)
|
||||
=+ .^(=yaki %cs (weld start-path /yaki/(scot %uv tak)))
|
||||
%+ roll p.yaki
|
||||
=< .(takos (~(put in *(set tako)) tak))
|
||||
|= [q=tako takos=(set tako)]
|
||||
?: (~(has in takos) q) :: already done
|
||||
takos :: hence skip
|
||||
(~(uni in takos) ^$(tak q)) :: otherwise traverse
|
||||
::
|
||||
++ get-deletes
|
||||
%- silt ^- (list path)
|
||||
%+ murn ~(tap by (~(uni by q.bob-yaki) q.ali-yaki))
|
||||
|= [=path =lobe]
|
||||
^- (unit ^path)
|
||||
=/ a (~(get by q.ali-yaki) path)
|
||||
=/ b (~(get by q.bob-yaki) path)
|
||||
?: |(=(a b) !=(~ a))
|
||||
~
|
||||
`path
|
||||
::
|
||||
++ get-changes
|
||||
%- silt ^- (list path)
|
||||
%+ murn ~(tap by (~(uni by q.bob-yaki) q.ali-yaki))
|
||||
|= [=path =lobe]
|
||||
^- (unit ^path)
|
||||
=/ a (~(get by q.ali-yaki) path)
|
||||
=/ b (~(get by q.bob-yaki) path)
|
||||
?: |(=(a b) =(~ a))
|
||||
~
|
||||
`path
|
||||
--
|
||||
::
|
||||
++ checkout
|
||||
|^
|
||||
|= [=bob=dome =yaki deletes=(set path) changes=(set path)]
|
||||
=/ m (strand ,[ankh (map path cage)])
|
||||
^- form:m
|
||||
=/ start-path /(scot %p our)/[bob-desk]/(scot %da wen)
|
||||
=/ builds
|
||||
%- malt
|
||||
%+ turn ~(tap in changes)
|
||||
|= =path
|
||||
[path (lobe-to-schematic start-path (~(got by q.yaki) path))]
|
||||
;< results=(map path cage) bind:m (build-cages:strandio builds)
|
||||
(pure:m (checkout:clay-commit ank.bob-dome deletes results) results)
|
||||
::
|
||||
++ lobe-to-schematic
|
||||
|= [=start=path =lobe]
|
||||
^- schematic:ford
|
||||
=+ .^(=blob %cs (weld start-path /blob/(scot %uv lobe)))
|
||||
=/ =disc:ford [our bob-desk]
|
||||
?- -.blob
|
||||
%direct (page-to-schematic disc q.blob)
|
||||
%delta [%pact disc $(lobe q.q.blob) (page-to-schematic disc r.blob)]
|
||||
==
|
||||
::
|
||||
++ page-to-schematic
|
||||
|= [=disc:ford =page]
|
||||
?. ?=(%hoon p.page)
|
||||
[%volt disc page]
|
||||
[%$ p.page [%atom %t ~] q.page]
|
||||
--
|
||||
--
|
Loading…
Reference in New Issue
Block a user