From 979898f2bf89e3bcaff2ab98fdd1fa450e8b859c Mon Sep 17 00:00:00 2001 From: Philip C Monk Date: Wed, 18 Feb 2015 19:53:28 -0500 Subject: [PATCH] ford %join --- arvo/clay.hoon | 75 ++++++++++++++++++++++++++-------------- arvo/ford.hoon | 66 +++++++++++++++++++++++++++++++---- arvo/hoon.hoon | 2 +- arvo/zuse.hoon | 2 +- main/app/merge/core.hook | 4 +-- main/mar/mime/door.hook | 1 + main/mar/txt/door.hook | 4 +++ 7 files changed, 117 insertions(+), 37 deletions(-) diff --git a/arvo/clay.hoon b/arvo/clay.hoon index c21ef301a..0626b00ee 100644 --- a/arvo/clay.hoon +++ b/arvo/clay.hoon @@ -38,8 +38,8 @@ ali=yaki :: ali's commit bob=yaki :: bob's commit bas=yaki :: mergebase - dal=(map path cage) :: diff(bas,ali) - dob=(map path cage) :: diff(bas,bob) + dal=(map path (unit cage)) :: diff(bas,ali) + dob=(map path (unit cage)) :: diff(bas,bob) new=yaki :: merge(dal,dob) ank=ankh :: new state erg=(map path ,?) :: ergoable changes @@ -98,6 +98,7 @@ [%done p=(set beam) q=gage] :: literal [%dude p=tank q=silk] :: error wrap [%dune p=(set beam) q=(unit gage)] :: unit literal + [%join p=mark q=silk r=silk] :: merge [%mute p=silk q=(list (pair wing silk))] :: mutant [%pact p=silk q=silk] :: patch [%reef ~] :: kernel reef @@ -1229,7 +1230,7 @@ `(map path ,?)`(~(run by q.ali.dat) |=(lobe %&)) checkout :: - ?(%mate %meld) + ?(%meet %mate %meld) ?: =(r.ali.dat r.bob.dat) +>.^$(gon `~) ?: (~(has in (reachable-takos r.bob.dat)) r.ali.dat) @@ -1238,9 +1239,9 @@ $(gem.dat %fine) =+ r=(find-merge-points:he ali.dat bob.dat) ?~ r - +>.^$(gon ``[%mate-no-merge-base >ali< >bob< ~]) + +>.^$(gon ``[%merge-no-merge-base >ali< >bob< ~]) ?. ?=([* ~ ~] r) - +>.^$(gon ``[%mate-criss-cross >ali< >bob< ~]) + +>.^$(gon ``[%merge-criss-cross >ali< >bob< ~]) =. bas.dat n.r diff-ali == @@ -1259,9 +1260,11 @@ %+ murn (~(tap by q.bas.dat)) |= [pax=path lob=lobe] ^- (unit (pair silk silk)) - =+ (~(get by q.yak) lob) + =+ (~(get by q.yak) pax) ?~ - - ~ + :- ~ + :- [%done ~ %path !>(pax)] + [%done ~ %null !>(~)] ?: =(lob u.-) ~ :- ~ @@ -1287,7 +1290,7 @@ =+ cay=q.p.res ?@ p.cay +>.$(gon ``[%diff-ali-bad-marc >ali< >bob< >p.cay< ~]) - =| dal=(map path cage) + =| dal=(map path (unit cage)) => |- ^+ + ?~ p.p.cay @@ -1306,7 +1309,9 @@ dal %+ ~(put by dal:tal) ((hard path) -.q.coy) - [q.i.p.p.cay (slot 3 coy)] + ?: ?=(%null q.i.p.p.cay) + ~ + `[q.i.p.p.cay (slot 3 coy)] == ?^ gon +>.$ @@ -1325,7 +1330,7 @@ =+ cay=q.p.res ?@ p.cay +>.$(gon ``[%diff-bob-bad-marc >ali< >bob< >p.cay< ~]) - =| dal=(map path cage) + =| dal=(map path (unit cage)) => |- ^+ + ?~ p.p.cay @@ -1344,7 +1349,9 @@ dal %+ ~(put by dal:tal) ((hard path) -.q.coy) - [q.i.p.p.cay (slot 3 coy)] + ?: ?=(%null q.i.p.p.cay) + ~ + `[q.i.p.p.cay (slot 3 coy)] == ?^ gon +>.$ @@ -1354,28 +1361,44 @@ ++ merge ^+ . ?+ gem.dat ~| %merge-weird-gem !! - %mate + %meet =+ (~(int by dal.dat) dob.dat) ?^ - - +(gon ``[%mate-conflict >ali< >bob< >[-]< ~]) - =^ new lat.ran :: XX forgot deletes - ^- [(map path lobe) (map lobe blob)] + +(gon ``[%meet-conflict >ali< >bob< >[-]< ~]) + =^ new lat.ran + ^- [(map path lobe) (map lobe blob)] + %+ roll (~(tap by (~(uni by dal.dat) dob.dat))) + =< .(lat lat.ran) + |= $: [pax=path cay=(unit cage)] + new=(map path lobe) + lat=(map lobe blob) + == + ?~ cay + [new lat] + =+ ^= bol + =+ (~(get by q.bas.dat) pax) + ?~ - + (make-direct u.cay) + (make-delta u.- u.cay) + [(~(put by new) pax p.bol) (~(put by lat) p.bol bol)] + =+ ^- [del=(map path ,?) old=(map path lobe)] %+ roll (~(tap by (~(uni by dal.dat) dob.dat))) - =< .(lat lat.ran) - |= [[pax=path cay=cage] new=(map path lobe) lat=(map lobe blob)] - =+ ^= bol - =+ (~(get by q.bas.dat) pax) - ?~ - - (make-direct cay) - (make-delta u.- cay) - [(~(put by new) pax p.bol) (~(put by lat) p.bol bol)] + =< .(old q.bas.dat) + |= $: [pax=path cay=(unit cage)] + del=(map path ,?) + old=(map path lobe) + == + ?^ cay + [del old] + [(~(put by del) pax %|) (~(del by old) pax)] =. new.dat - (make-yaki [r.ali.dat r.bob.dat ~] (~(uni by q.bas.dat) new) now) + (make-yaki [r.ali.dat r.bob.dat ~] (~(uni by old) new) now) =. hut.ran (~(put by hut.ran) r.new.dat new.dat) - =. erg.dat (~(run by new) |=(lobe %&)) + =. erg.dat %- ~(uni by del) + `(map path ,?)`(~(run by new) |=(lobe %&)) checkout :: - %meld .(gon ``[%merge-not-implemented ~]) + ?(%mate %meld) .(gon ``[%merge-not-implemented ~]) == :: ++ merged diff --git a/arvo/ford.hoon b/arvo/ford.hoon index 922d1137e..0c90afa50 100644 --- a/arvo/ford.hoon +++ b/arvo/ford.hoon @@ -74,6 +74,7 @@ [%done p=(set beam) q=gage] :: literal [%dude p=tank q=silk] :: error wrap [%dune p=(set beam) q=(unit gage)] :: unit literal + [%join p=mark q=silk r=silk] :: merge [%mute p=silk q=(list (pair wing silk))] :: mutant [%pact p=silk q=silk] :: patch [%plan p=beam q=spur r=hood] :: structured assembly @@ -397,8 +398,7 @@ == |= [cof=cafe cay=gage coy=gage] ?. &(?=(@ p.cay) ?=(@ p.coy)) - ~| %bad-diff-marc - !! + (flaw cof leaf/"bad diff marc" ~) ?. =(p.cay p.coy) %+ flaw cof :_ ~ leaf/"diff on data of different marks: {(trip p.cay)} {(trip p.coy)}" @@ -415,7 +415,9 @@ =+ for=((soft ,@tas) q:(slap gar [%cnzy %sted])) ?~ for (flaw cof leaf/"bad ++sted:grad" ~) - (make cof %diff [%cast u.for kas] [%cast u.for kos]) + %^ make cof %diff + :- [%cast u.for [%done ~ cay]] + [%cast u.for [%done ~ coy]] ?. (slab %diff p.gar) (flaw cof leaf/"no ++diff:grad" ~) %+ cope (keel cof pro [[%& 6]~ q.cay]~) @@ -423,7 +425,7 @@ %+ cope %^ maul cof (slap (slap pox [%cnzy %grad]) [%cnzy %diff]) - q.coy + (slop q.cay q.coy) |= [cof=cafe dif=vase] =+ for=((soft ,@tas) q:(slap gar [%cnzy %form])) ?~ for @@ -638,6 +640,48 @@ -- -- :: + ++ join + |= [cof=cafe for=mark kas=silk kos=silk] + ^- (bolt gage) + %. [cof kas kos] + ;~ cope + ;~ coax + |=([cof=cafe p=silk q=silk] (make cof p)) + |=([cof=cafe p=silk q=silk] (make cof q)) + == + |= [cof=cafe cay=gage coy=gage] + ?. &(?=(@ p.cay) ?=(@ p.coy)) + (flaw cof leaf/"bad join marc: {} {}" ~) + %+ cope (fang cof for [our %main %da now]) + |= [cof=cafe pro=vase] + ?. (slab %grad p.pro) + (flaw cof leaf/"no ++grad" ~) + =+ gar=(slap pro [%cnzy %grad]) + ?. (slab %form p.gar) + ?. (slab %sted p.gar) + (flaw cof leaf/"no ++form:grad nor ++sted:grad" ~) + =+ too=((soft ,@tas) q:(slap gar [%cnzy %sted])) + ?~ too + (flaw cof leaf/"bad ++sted:grad" ~) + (make cof %join u.too [%done ~ cay] [%done ~ coy]) + =+ fom=((soft ,@tas) q:(slap gar [%cnzy %form])) + ?~ fom + (flaw cof leaf/"bad ++form:grad" ~) + ?. &(=(fom p.cay) =(fom p.coy)) + %+ flaw cof :_ ~ + leaf/"join on data of bad marks: {(trip p.cay)} {(trip p.coy)}" + ?: =(q.q.cay q.q.coy) + (fine cof cay) + ?. (slab %join p.gar) + (flaw cof leaf/"no ++join:grad" ~) + %+ cope + %^ maul cof + (slap (slap pro [%cnzy %grad]) [%cnzy %join]) + q.coy + |= [cof=cafe dif=vase] + (fine cof p.cay dif) + == + :: ++ kale :: mutate |= [cof=cafe kas=silk muy=(list (pair wing silk))] ^- (bolt gage) @@ -940,7 +984,8 @@ |= [cof=cafe cay=gage] ^- (bolt gage) %+ cool |.(leaf/"ford: casting {} to {}") - ?. ?=(@ p.cay) ~| %bad-cast-marc !! + ?. ?=(@ p.cay) + (flaw cof leaf/"bad cast marc" ~) %+ cope (link cof p.kas p.cay [our %main %da now] q.cay) |= [cof=cafe vax=vase] (fine cof [p.kas vax]) @@ -954,6 +999,12 @@ %dune ?~ q.kas [cof [%2 [%leaf "no data"]~]] $(kas [%done p.kas u.q.kas]) + :: + %join + %+ cool + |. + leaf/"ford: join {} {<`@p`(mug q.kas)>} {<`@p`(mug r.kas)>}" + (join cof p.kas q.kas r.kas) :: %mute (kale cof p.kas q.kas) %pact @@ -1303,7 +1354,8 @@ |=([cof=cafe p=silk q=silk] (make cof q)) == |= [cof=cafe cay=gage coy=gage] - ?. &(?=(@ p.cay) ?=(@ p.coy)) ~| %bad-pact-marc !! + ?. &(?=(@ p.cay) ?=(@ p.coy)) + (flaw cof leaf/"bad pact marc" ~) %+ cope (fang cof p.cay [our %main %da now]) |= [cof=cafe pro=vase] ?. (slab %grad p.pro) @@ -1315,7 +1367,7 @@ =+ for=((soft ,@tas) q:(slap gar [%cnzy %sted])) ?~ for (flaw cof leaf/"bad ++sted:grad" ~) - (make cof %cast p.cay %pact [%cast u.for kas] kos) + (make cof %cast p.cay %pact [%cast u.for [%done ~ cay]] [%done ~ coy]) =+ for=((soft ,@tas) q:(slap gar [%cnzy %form])) ?~ for (flaw cof leaf/"bad ++form:grad" ~) diff --git a/arvo/hoon.hoon b/arvo/hoon.hoon index 17573424c..6405afca6 100644 --- a/arvo/hoon.hoon +++ b/arvo/hoon.hoon @@ -50,7 +50,7 @@ [std=term kel=@] :: kelvin version [ven=term pro=term kel=@] :: vendor and product [ven=term pro=term ver=@ kel=@] :: all of the above - == + == :: ++ clue ,[p=chum q=nock r=(list (pair term nock))] :: battery definition ++ coil $: p=?(%gold %iron %lead %zinc) :: core type q=type :: diff --git a/arvo/zuse.hoon b/arvo/zuse.hoon index b1954567d..599220c64 100644 --- a/arvo/zuse.hoon +++ b/arvo/zuse.hoon @@ -2902,7 +2902,7 @@ == :: ++ gilt ,[@tas *] :: presumed gift ++ gens ,[p=lang q=gcos] :: general identity -++ germ ?(%init %fine %that %this %mate %meld) :: merge style +++ germ ?(%init %fine %that %this %mate %meet %meld) :: merge style ++ gcos :: id description $% [%czar ~] :: 8-bit ship [%duke p=what] :: 32-bit ship diff --git a/main/app/merge/core.hook b/main/app/merge/core.hook index 1e86c3497..87fea2f02 100644 --- a/main/app/merge/core.hook +++ b/main/app/merge/core.hook @@ -20,8 +20,8 @@ ?~ - [leaf/"not working so well" >sih< ~] ?~ are.u - [leaf/"synced" ~] - [leaf/"failed to sync" >p.u.are.u< q.u.are.u] + [leaf/"merged" ~] + [leaf/"failed to merge" >p.u.are.u< q.u.are.u] %- flop :- i=[ost %pass / %g %cide %$] ^= t diff --git a/main/mar/mime/door.hook b/main/mar/mime/door.hook index d7c54deac..7f61733c9 100644 --- a/main/mar/mime/door.hook +++ b/main/mar/mime/door.hook @@ -12,5 +12,6 @@ ++ form %mime ++ diff |=(mime +<) ++ pact |=(mime +<) + ++ join |=([mime mime] +<-) -- -- diff --git a/main/mar/txt/door.hook b/main/mar/txt/door.hook index c8ee2c38d..326cdc32e 100644 --- a/main/mar/txt/door.hook +++ b/main/mar/txt/door.hook @@ -28,5 +28,9 @@ |= dif=(urge cord) ^- wain (lurk txt dif) + ++ join + |= [ali=(urge cord) bob=(urge cord)] + ^- (urge cord) + ali -- --