urbit/main/arvo/clay.hoon

2712 lines
91 KiB
Plaintext
Raw Normal View History

2014-11-01 01:36:01 +03:00
!:
2013-09-29 00:21:18 +04:00
:: clay (4c), revision control
2015-02-27 09:35:41 +03:00
::
2013-12-15 09:42:27 +04:00
|= pit=vase
2014-06-03 09:07:32 +04:00
=> |%
2015-02-27 09:35:41 +03:00
++ cane :: change set
$: new=(map path lobe) :: new files
2015-04-18 10:31:58 +03:00
cal=(map path lobe) :: old diffs
can=(map path cage) :: new diffs
2015-02-27 09:35:41 +03:00
old=(map path ,~) :: deleted files
== ::
++ cult (map duct rove) :: subscriptions
2015-02-27 09:35:41 +03:00
++ dojo :: domestic desk state
$: qyx=cult :: subscribers
dom=dome :: desk data
dok=(unit dork) :: outstanding diffs
mer=(map (pair ship desk) mery) :: outstanding merges
== ::
2014-06-03 09:07:32 +04:00
++ gift :: out result <-$
2015-02-27 09:35:41 +03:00
$% [%ergo p=@p q=@tas r=@ud s=(list ,[path (unit mime)])]
:: version update
[%mere p=(each (set path) (pair term (list tank)))]
:: merge result
2014-06-04 14:40:09 +04:00
[%note p=@tD q=tank] :: debug message
[%writ p=riot] :: response
== ::
2015-02-27 09:35:41 +03:00
++ khan ::
2015-03-10 00:36:04 +03:00
$: fil=(unit (unit cage)) :: XX see khan-to-soba
2015-02-27 09:35:41 +03:00
dir=(map ,@ta khan) ::
== ::
2014-06-03 09:07:32 +04:00
++ kiss :: in request ->$
2014-10-28 22:59:26 +03:00
$% [%font p=@p q=@tas r=@p s=@tas] :: set upstream
[%info p=@p q=@tas r=nori] :: internal edit
2014-06-04 14:40:09 +04:00
[%init p=@p] :: report install
2015-02-27 09:35:41 +03:00
[%into p=@p q=@tas r=khan] :: external edit
[%merg p=@p q=@tas r=@p s=@tas t=germ] :: merge desks
2014-10-28 22:59:26 +03:00
[%plug p=@p q=@tas r=@p s=@tas] :: unset upstream
2014-06-04 14:40:09 +04:00
[%wart p=sock q=@tas r=path s=*] :: network request
[%warp p=sock q=riff] :: file request
== ::
2015-02-27 09:35:41 +03:00
++ mery ::
$: gem=germ :: strategy
cas=case :: ali's case
ali=yaki :: ali's commit
bob=yaki :: bob's commit
bas=yaki :: mergebase
dal=cane :: diff(bas,ali)
dob=cane :: diff(bas,bob)
2015-04-21 23:23:50 +03:00
bof=(map path (unit cage)) :: conflict diffs
bop=(map path cage) :: conflict patches
2015-02-27 09:35:41 +03:00
new=yaki :: merge(dal,dob)
ank=ankh :: new state
erg=(map path ,?) :: ergoable changes
gon=(each (set path) (pair term (list tank))) :: return value
== ::
2014-09-09 04:21:40 +04:00
++ moot ,[p=case q=case r=path s=(map path lobe)] :: stored change range
2014-06-22 09:49:10 +04:00
++ move ,[p=duct q=(mold note gift)] :: local move
2015-03-04 04:05:41 +03:00
++ nako $: gar=(map aeon tako) :: new ids
let=aeon :: next id
2014-07-22 22:56:04 +04:00
lar=(set yaki) :: new commits
2015-03-04 04:05:41 +03:00
bar=(set plop) :: new content
2014-07-22 22:56:04 +04:00
== ::
2014-06-03 09:07:32 +04:00
++ note :: out request $->
2014-06-22 02:06:42 +04:00
$% $: %a :: to %ames
$% [%want p=sock q=path r=*] ::
== == ::
$: %c :: to %clay
2014-10-28 22:59:26 +03:00
$% [%font p=@p q=@tas r=@p s=@tas] ::
2015-02-27 09:35:41 +03:00
[%info p=@p q=@tas r=nori] :: internal edit
2015-03-05 03:36:29 +03:00
[%merg p=@p q=@tas r=@p s=@tas t=germ] :: merge desks
2014-10-28 04:50:07 +03:00
[%warp p=sock q=riff] ::
2014-06-22 02:06:42 +04:00
== == ::
$: %d ::
2014-06-04 14:40:09 +04:00
$% [%flog p=[%crud p=@tas q=(list tank)]] :: to %dill
2015-02-27 09:35:41 +03:00
== == ::
$: %f ::
2015-03-12 03:37:37 +03:00
$% [%exec p=@p q=beak r=(unit silk)] ::
2014-10-17 00:42:45 +04:00
== == ::
$: %t ::
$% [%wait p=@da] ::
[%rest p=@da] ::
2014-06-22 02:06:42 +04:00
== == == ::
2014-07-02 02:51:42 +04:00
++ sign :: in result $<-
2014-06-22 02:06:42 +04:00
$? $: %a :: by %ames
$% [%waft p=sock q=*] ::
2014-06-22 02:06:42 +04:00
[%went p=ship q=cape] ::
== == ::
$: %c :: by %clay
2015-03-05 03:36:29 +03:00
$% [%mere p=(each (set path) (pair term (list tank)))]
[%writ p=riot] ::
2015-02-27 09:35:41 +03:00
== == ::
$: %f ::
$% [%made p=@uvH q=(each gage (list tank))] ::
2014-10-17 00:42:45 +04:00
== == ::
$: %t ::
$% [%wake ~] :: timer activate
2014-06-22 02:06:42 +04:00
== == ::
$: @tas :: by any
$% [%crud p=@tas q=(list tank)] ::
== == == ::
2015-02-27 09:35:41 +03:00
++ silk :: construction layer
$& [p=silk q=silk] :: cons
$% [%bake p=mark q=beam r=path] :: local synthesis
[%boil p=mark q=beam r=path] :: general synthesis
2015-03-11 00:09:53 +03:00
[%bunt p=mark] :: example of mark
2015-02-27 09:35:41 +03:00
[%call p=silk q=silk] :: slam
[%cast p=mark q=silk] :: translate
[%diff p=silk q=silk] :: diff
[%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
[%ride p=twig q=silk] :: silk thru twig
[%tabl p=(list (pair silk silk))] :: list
[%vale p=mark q=ship r=*] :: validate [our his]
2015-03-11 02:56:08 +03:00
[%volt p=(set beam) q=(cask ,*)] :: unsafe add type
2015-02-27 09:35:41 +03:00
== ::
2014-06-11 18:06:36 +04:00
++ raft :: filesystem
$: fat=(map ship room) :: domestic
hoy=(map ship rung) :: foreign
2014-07-22 22:56:04 +04:00
ran=rang :: hashes
2015-03-23 23:40:33 +03:00
$= sor :: upstreams
(map ,[p=@p q=@tas r=@p s=@tas] ,[let=@ud hen=duct])
2014-06-11 18:06:36 +04:00
== ::
++ rede :: universal project
$: lim=@da :: complete to
qyx=cult :: subscribers
ref=(unit rind) :: outgoing requests
dom=dome :: revision state
2015-02-27 09:35:41 +03:00
dok=(unit dork) :: outstanding diffs
mer=(map (pair ship desk) mery) :: outstanding merges
2014-06-11 18:06:36 +04:00
== ::
++ riff ,[p=desk q=(unit rave)] :: request/desist
++ rind :: request manager
$: nix=@ud :: request index
bom=(map ,@ud ,[p=duct q=rave]) :: outstanding
fod=(map duct ,@ud) :: current requests
2015-02-27 09:35:41 +03:00
haw=(map mood (unit cage)) :: simple cache
2015-03-04 04:05:41 +03:00
nak=(unit nako) :: pending validation
2014-06-11 18:06:36 +04:00
== ::
++ room :: fs per ship
$: hun=duct :: terminal duct
2014-09-16 18:19:15 +04:00
hez=(unit duct) :: sync duct
2014-06-11 18:06:36 +04:00
dos=(map desk dojo) :: native desk
== ::
2015-03-27 02:26:39 +03:00
++ rove :: stored request
$% [%sing p=mood] :: single request
[%many p=? q=moot] :: change range
== ::
2014-06-11 18:06:36 +04:00
++ rung $: rus=(map desk rede) :: neighbor desks
== ::
2015-03-11 00:09:53 +03:00
++ tage ,[[%tabl p=(list (pair marc marc))] q=vase] :: %tabl gage
2015-02-27 09:35:41 +03:00
++ dork :: diff work
2015-04-15 03:48:37 +03:00
$: del=(list (pair path cage)) :: deletes
ink=(list (pair path cage)) :: hoo{n,k}
ins=(unit (list (pair path cage))) :: inserts
dig=(map path cage) :: store diffs
dif=(unit (list (trel path lobe cage))) :: changes
muh=(map path lobe) :: store hashes
mut=(unit (list (trel path lobe cage))) :: mutations
2015-04-17 03:22:39 +03:00
mim=(map path mime) :: mime cache
2015-02-27 09:35:41 +03:00
== ::
2014-06-03 09:07:32 +04:00
-- =>
2015-02-27 09:35:41 +03:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 4cA, filesystem logic ::
::
::
::
|%
++ de :: per desk
|= [now=@da hen=duct hun=duct hez=(unit duct)]
|= [[who=@p for=@p] syd=@ta rede ran=rang]
=* red +<+>-
=| yel=(list ,[p=duct q=gift])
=| byn=(list ,[p=duct q=riot])
=| reg=(list ,[p=duct q=gift])
=| say=(list ,[p=duct q=path r=ship s=[p=@ud q=riff]])
2015-04-14 03:29:54 +03:00
=| tag=(list move)
2015-02-27 09:35:41 +03:00
|%
++ abet
^- [(list move) rede]
:_ red
;: weld
%+ turn (flop yel)
|=([a=duct b=gift] [hun %give b])
::
%+ turn (flop byn)
2015-03-14 01:52:15 +03:00
|=([a=duct b=riot] [a %give [%writ b]])
2015-02-27 09:35:41 +03:00
::
%+ turn (flop reg)
|=([a=duct b=gift] [a %give b])
::
%+ turn (flop say)
|= [a=duct b=path c=ship d=[p=@ud q=riff]]
:- a
[%pass b %a %want [who c] [%q %re p.q.d (scot %ud p.d) ~] q.d]
::
2015-04-14 03:29:54 +03:00
tag
2015-02-27 09:35:41 +03:00
==
2013-09-29 00:21:18 +04:00
::
2015-04-17 03:22:39 +03:00
++ aver :: read
2015-02-27 09:35:41 +03:00
|= mun=mood
2015-03-31 01:12:18 +03:00
^- (unit (unit (each cage silk)))
2015-04-17 03:22:39 +03:00
?: &(=(p.mun %u) !=(p.q.mun now)) :: prevent bad things
2015-02-27 09:35:41 +03:00
~& [%clay-fail p.q.mun %now now]
!!
=+ ezy=?~(ref ~ (~(get by haw.u.ref) mun))
2015-03-31 01:12:18 +03:00
?^ ezy
`(bind u.ezy (cury same %&))
2015-02-27 09:35:41 +03:00
=+ nao=(case-to-aeon:ze q.mun)
:: ~& [%aver-mun nao [%from syd lim q.mun]]
?~(nao ~ (read-at-aeon:ze u.nao mun))
2013-09-29 00:21:18 +04:00
::
2015-03-11 00:09:53 +03:00
++ made-to-tage
|= res=(each gage tang)
2015-03-11 00:09:53 +03:00
^- tage
?: ?=(%| -.res)
~| %ford-fail
~> %mean.|.(p.res) :: interpolate ford fail into stack trace
!!
?@ p.p.res
2015-03-11 00:09:53 +03:00
~|(%bad-marc !!)
p.res
2015-03-11 00:09:53 +03:00
::
++ tage-to-cages
|= tab=tage
^- (list (pair cage cage))
?~ p.tab
~
:_ $(p.tab t.p.tab, q.tab (slot 3 q.tab))
~| %strange-gage
:- [?^(p.i.p.tab !! p.i.p.tab) (slot 4 q.tab)]
[?^(q.i.p.tab !! q.i.p.tab) (slot 5 q.tab)]
::
2015-02-27 09:35:41 +03:00
++ balk :: read and send
2015-03-31 01:12:18 +03:00
|= [hen=duct cay=(unit (each cage silk)) mun=mood]
2015-02-27 09:35:41 +03:00
^+ +>
2015-03-14 00:47:29 +03:00
?~ cay (blub hen)
(blab hen mun u.cay)
2014-05-30 06:12:02 +04:00
::
2015-02-27 09:35:41 +03:00
++ bait
|= [hen=duct tym=@da]
2015-04-14 03:29:54 +03:00
%_(+> tag :_(tag [hen %pass /tyme %t %wait tym]))
2015-02-27 09:35:41 +03:00
::
++ best
|= [hen=duct tym=@da]
2015-04-14 03:29:54 +03:00
%_(+> tag :_(tag [hen %pass /tyme %t %rest tym]))
2015-02-27 09:35:41 +03:00
::
++ blab :: ship result
2015-03-31 01:12:18 +03:00
|= [hen=duct mun=mood dat=(each cage silk)]
2015-02-27 09:35:41 +03:00
^+ +>
2015-03-31 01:12:18 +03:00
?: ?=(%& -.dat)
+>.$(byn [[hen ~ [p.mun q.mun syd] r.mun p.dat] byn])
=- +>.$(tag [- tag])
2015-04-14 03:29:54 +03:00
:* hen %pass [%blab p.mun (scot q.mun) syd r.mun]
2015-03-31 01:12:18 +03:00
%f %exec who [who syd q.mun] ~ p.dat
==
2015-02-27 09:35:41 +03:00
::
++ bleb :: ship sequence
2015-03-27 02:26:39 +03:00
|= [hen=duct ins=@ud hip=(unit (pair aeon aeon))]
2015-02-27 09:35:41 +03:00
^+ +>
2015-03-27 02:26:39 +03:00
%^ blab hen [%w [%ud ins] ~]
2015-03-31 01:12:18 +03:00
:- %&
2015-03-27 02:26:39 +03:00
?~ hip
[%null [%atom %n] ~]
[%nako !>((make-nako:ze u.hip))]
2015-02-27 09:35:41 +03:00
::
++ blub :: ship stop
|= hen=duct
%_(+> byn [[hen ~] byn])
::
++ duce :: produce request
|= rov=rove
^+ +>
=. qyx (~(put by qyx) hen rov)
?~ ref
(mabe rov (cury bait hen))
|- ^+ +>+.$ :: XX why?
=+ rav=(reve rov)
=+ ^= vaw ^- rave
2015-03-27 02:26:39 +03:00
?. ?=([%sing %v *] rav) rav
[%many %| [%ud let.dom] `case`q.p.rav r.p.rav]
2015-02-27 09:35:41 +03:00
=+ inx=nix.u.ref
2015-03-27 02:26:39 +03:00
~? ?=([%sing %x *] vaw)
2015-03-19 22:34:25 +03:00
[%remote-x-ing vaw hen]
2015-02-27 09:35:41 +03:00
%= +>+.$
say [[hen [(scot %ud inx) ~] for [inx syd ~ vaw]] say]
nix.u.ref +(nix.u.ref)
bom.u.ref (~(put by bom.u.ref) inx [hen vaw])
fod.u.ref (~(put by fod.u.ref) hen inx)
==
::
++ ease :: release request
^+ .
?~ ref
=+ rov=(~(got by qyx) hen)
=. qyx (~(del by qyx) hen)
(mabe rov (cury best hen))
=. qyx (~(del by qyx) hen)
|- ^+ +.$
=+ nux=(~(get by fod.u.ref) hen)
?~ nux +.$
%= +.$
say [[hen [(scot %ud u.nux) ~] for [u.nux syd ~]] say]
fod.u.ref (~(del by fod.u.ref) hen)
bom.u.ref (~(del by bom.u.ref) u.nux)
==
::
++ eave :: subscribe
|= rav=rave
^+ +>
?- -.rav
2015-03-27 02:26:39 +03:00
%sing
2015-02-27 09:35:41 +03:00
?: &(=(p.p.rav %u) !=(p.q.p.rav now))
~& [%clay-fail p.q.p.rav %now now]
!!
=+ ver=(aver p.rav)
?~ ver
(duce rav)
?~ u.ver
(blub hen)
(blab hen p.rav u.u.ver)
::
2015-03-27 02:26:39 +03:00
%many
=+ nab=(case-to-aeon:ze p.q.rav)
2015-02-27 09:35:41 +03:00
?~ nab
2015-03-27 02:26:39 +03:00
?> =(~ (case-to-aeon:ze q.q.rav))
2015-02-27 09:35:41 +03:00
(duce (rive rav))
2015-03-27 02:26:39 +03:00
=+ huy=(case-to-aeon:ze q.q.rav)
2015-02-27 09:35:41 +03:00
?: &(?=(^ huy) |((lth u.huy u.nab) &(=(0 u.huy) =(0 u.nab))))
(blub hen)
=+ top=?~(huy let.dom u.huy)
2015-03-27 02:26:39 +03:00
=+ sar=(lobes-at-path:ze u.nab r.q.rav)
=+ ear=(lobes-at-path:ze top r.q.rav)
2015-02-27 09:35:41 +03:00
=. +>.$
?: =(sar ear) +>.$
2015-03-27 02:26:39 +03:00
(bleb hen u.nab ?:(p.rav ~ `[u.nab top]))
2015-02-27 09:35:41 +03:00
?^ huy
(blub hen)
=+ ^= ptr ^- case
[%ud +(let.dom)]
2015-03-27 02:26:39 +03:00
(duce `rove`[%many p.rav ptr q.q.rav r.q.rav ear])
2015-02-27 09:35:41 +03:00
==
::
++ echa :: announce raw
|= [wen=@da mer=mizu]
^+ +>
%= +>
reg ~& %merge-announce reg
:: ?~(hez reg :_(reg [u.hez [%ergo who syd let.dom]]))
:: yel [[hen %note '=' %leaf ~] yel] :: XX do better
==
::
2015-04-15 03:48:37 +03:00
++ echo :: announce changes
2015-04-17 03:22:39 +03:00
|= [wen=@da lem=nuri]
2015-02-27 09:35:41 +03:00
^+ +>
%_ +>.$
yel
=+ pre=`path`~[(scot %p for) syd (scot %ud let.dom)]
?- -.lem
| :_ yel
[hen %note '=' %leaf :(weld (trip p.lem) " " (spud pre))]
& |- ^+ yel
?~ q.p.lem yel
:_ $(q.p.lem t.q.p.lem)
:- hen
:+ %note
2015-04-17 03:22:39 +03:00
?-(-.q.i.q.p.lem %del '-', %ins '+', %dif ':')
2015-02-27 09:35:41 +03:00
[%leaf (spud (weld pre p.i.q.p.lem))]
==
==
::
2015-04-15 03:48:37 +03:00
++ edit :: apply changes
2015-02-27 09:35:41 +03:00
|= [wen=@da lem=nori]
^+ +>
?: ?=(%| -.lem)
=^ hat +>.$
(edit:ze wen lem)
?~ hat
+>.$
2015-04-17 03:22:39 +03:00
(echo:(checkout-ankh u.hat) wen lem)
2015-02-27 09:35:41 +03:00
?. =(~ dok)
~& %already-applying-changes +>
2015-04-15 03:48:37 +03:00
=+ del=(skim q.p.lem :(corl (cury test %del) head tail))
=+ ins=(skim q.p.lem :(corl (cury test %ins) head tail))
=+ dif=(skim q.p.lem :(corl (cury test %dif) head tail))
=+ mut=(skim q.p.lem :(corl (cury test %mut) head tail))
2015-04-17 03:22:39 +03:00
=^ ink ins
^- [(list (pair path miso)) (list (pair path miso))]
%+ skid `(list (pair path miso))`ins
|= [pax=path mis=miso]
?> ?=(%ins -.mis)
?& ?=([?(%hoon %hook) *] (flop pax))
?=(%mime p.p.mis)
==
=- %_ +>.$
2015-04-15 03:48:37 +03:00
tag (welp - tag)
dok
:- ~
:* %+ turn del
|= [pax=path mis=miso]
?> ?=(%del -.mis)
[pax p.mis]
2015-04-17 03:22:39 +03:00
::
%+ turn ink
|= [pax=path mis=miso]
^- (pair path cage)
?> ?=(%ins -.mis)
=+ =>((flop pax) ?~(. %$ i))
[pax - [%atom %t] ((hard ,@t) +>.q.q.p.mis)]
::
2015-04-15 03:48:37 +03:00
~
2015-04-17 03:22:39 +03:00
::
2015-04-15 03:48:37 +03:00
%- mo
%+ turn dif
|= [pax=path mis=miso]
2015-04-17 03:22:39 +03:00
?> ?=(%dif -.mis)
2015-04-15 03:48:37 +03:00
[pax p.mis]
2015-04-17 03:22:39 +03:00
::
2015-04-15 03:48:37 +03:00
~
2015-04-17 03:22:39 +03:00
::
2015-04-15 03:48:37 +03:00
%- mo
%+ turn mut
|= [pax=path mis=miso]
?> ?=(%mut -.mis)
[pax (page-to-lobe:ze p.mis q.q.mis)]
2015-04-17 03:22:39 +03:00
::
2015-04-15 03:48:37 +03:00
~
2015-04-17 03:22:39 +03:00
::
%- mo ^- (list (pair path mime))
;: welp
^- (list (pair path mime))
%+ murn ins
|= [pax=path mis=miso]
^- (unit (pair path mime))
?> ?=(%ins -.mis)
?. ?=(%mime p.p.mis)
~
`[pax ((hard mime) q.q.p.mis)]
::
^- (list (pair path mime))
%+ murn ink
|= [pax=path mis=miso]
^- (unit (pair path mime))
?> ?=(%ins -.mis)
?> ?=(%mime p.p.mis)
`[pax ((hard mime) q.q.p.mis)]
::
^- (list (pair path mime))
%+ murn mut
|= [pax=path mis=miso]
^- (unit (pair path mime))
?> ?=(%mut -.mis)
?. ?=(%mime p.q.mis)
~
`[pax ((hard mime) q.q.q.mis)]
==
2015-04-15 03:48:37 +03:00
==
==
2015-04-14 03:29:54 +03:00
^- (list move)
:~ :* hen %pass
2015-04-17 03:22:39 +03:00
[%inserting (scot %p who) syd (scot %da wen) ~]
2015-04-14 03:29:54 +03:00
%f %exec who [who syd %da wen] ~ %tabl
^- (list (pair silk silk))
%+ turn ins
|= [pax=path mis=miso]
?> ?=(%ins -.mis)
2015-04-17 03:22:39 +03:00
:- [%done ~ %path -:!>(*path) pax]
2015-04-14 03:29:54 +03:00
=+ =>((flop pax) ?~(. %$ i))
[%cast - [%done ~ p.mis]]
==
:* hen %pass
2015-04-17 03:22:39 +03:00
[%diffing (scot %p who) syd (scot %da wen) ~]
2015-04-14 03:29:54 +03:00
%f %exec who [who syd %da wen] ~ %tabl
^- (list (pair silk silk))
%+ turn dif
|= [pax=path mis=miso]
?> ?=(%dif -.mis)
2015-04-17 03:22:39 +03:00
=+ (need (need (read-x:ze let.dom pax)))
2015-04-14 03:29:54 +03:00
?> ?=(%& -<)
2015-04-17 03:22:39 +03:00
:- [%done ~ %path -:!>(*path) pax]
[%pact [%done ~ p.-] [%done ~ p.mis]]
2015-04-14 03:29:54 +03:00
==
:* hen %pass
2015-04-17 03:22:39 +03:00
[%mutating (scot %p who) syd (scot %da wen) ~]
2015-04-14 03:29:54 +03:00
%f %exec who [who syd %da wen] ~ %tabl
^- (list (pair silk silk))
%+ turn mut
|= [pax=path mis=miso]
?> ?=(%mut -.mis)
2015-04-17 03:22:39 +03:00
:- [%done ~ %path -:!>(*path) pax]
2015-04-14 03:29:54 +03:00
[%diff [%done ~ p.mis] [%cast p.p.mis [%done ~ q.mis]]]
==
==
2015-04-15 03:48:37 +03:00
:: =+ ^= sop
:: |= [a=path b=miso]
:: ^- ?
:: ?| ?=(%del -.b)
:: ?=(%dif -.b)
:: ?& ?=(%ins -.b)
:: ?=(%mime p.p.b)
:: =+ (slag (dec (lent a)) a)
:: ?| =([%hook ~] -)
:: =([%hoon ~] -)
:: == == ==
:: =+ ^- lon=(list path)
:: (murn q.p.lem |=([a=path b=miso] ?:((sop a b) ~ (some a))))
:: =+ ^- sot=(list ,[p=path q=misu])
:: %+ murn q.p.lem
:: |=([a=path b=miso] ?.((sop a b) ~ (some [a ?<(?=(%mut -.b) b)])))
:: =+ ^- mim=(map path mime)
:: %- mo
:: ^- (list ,[path mime])
:: %+ murn q.p.lem
:: |= [a=path b=miso]
:: ?- -.b
:: %del ~
:: %ins ?.(?=(%mime p.p.b) ~ (some a ((hard mime) q.q.p.b)))
:: %dif ~
:: %mut ?.(?=(%mime p.q.b) ~ (some a ((hard mime) q.q.q.b)))
:: ==
:: =. dok `[sot lon mim]
:: ?~ lon
:: (apply-edit wen)
:: =+ ^- los=(list ,[duct path note])
:: %+ murn q.p.lem
:: |=([a=path b=miso] ?:((sop a b) ~ (some (silkify wen a b))))
:: %_(+>.$ tag (welp los tag))
2015-02-27 09:35:41 +03:00
::
++ silkify
|= [wen=@da pax=path mis=miso]
^- [duct path note]
~| [%silkifying pax -.mis]
2015-02-27 09:35:41 +03:00
:- hen
?+ -.mis !!
2015-02-27 09:35:41 +03:00
%mut
:- [%diffing (scot %p who) syd (scot %da wen) pax]
2015-03-12 03:37:37 +03:00
:^ %f %exec who :+ [who syd %da wen] ~
2015-02-27 09:35:41 +03:00
^- silk
=+ =+ (slag (dec (lent pax)) pax)
=+ ?~(- %$ i.-)
[%cast - [%done ~ q.mis]]
[%diff [%done ~ p.mis] -]
::
%ins
:- [%casting (scot %p who) syd (scot %da wen) pax]
2015-03-12 03:37:37 +03:00
:^ %f %exec who :+ [who syd %da wen] ~
2015-02-27 09:35:41 +03:00
^- silk
=+ (slag (dec (lent pax)) pax)
=+ ?~(- %$ i.-)
[%cast - [%done ~ p.mis]]
==
::
++ apply-edit
|= wen=@da
^+ +>
2015-04-17 03:22:39 +03:00
=+ ^- sim=(list (pair path misu))
2015-04-15 03:48:37 +03:00
?~ dok
~|(%no-changes !!)
?> ?=(^ ins.u.dok)
?> ?=(^ dif.u.dok)
?> ?=(^ mut.u.dok)
;: welp
^- (list (pair path misu))
(turn del.u.dok |=([pax=path cay=cage] [pax %del cay]))
2015-04-17 03:22:39 +03:00
::
^- (list (pair path misu))
(turn ink.u.dok |=([pax=path cay=cage] [pax %ins cay]))
2015-04-15 03:48:37 +03:00
::
^- (list (pair path misu))
(turn u.ins.u.dok |=([pax=path cay=cage] [pax %ins cay]))
::
^- (list (pair path misu))
(turn u.dif.u.dok |=([pax=path cal=[lobe cage]] [pax %dif cal]))
::
^- (list (pair path misu))
(turn u.mut.u.dok |=([pax=path cal=[lobe cage]] [pax %dif cal]))
==
2015-04-17 03:22:39 +03:00
=+ hat=(edit:ze wen %& *cart sim)
2015-02-27 09:35:41 +03:00
?~ dok ~& %no-changes !!
?~ -.hat
2015-04-17 03:22:39 +03:00
([echo(dok ~)]:.(+>.$ +.hat) wen %& *cart sim)
2015-02-27 09:35:41 +03:00
(checkout-ankh(lat.ran lat.ran.+.hat) u.-.hat)
::
2015-04-15 03:48:37 +03:00
++ take-inserting
|= [wen=@da res=(each gage tang)]
2015-02-27 09:35:41 +03:00
^+ +>
?~ dok
2015-04-15 03:48:37 +03:00
~& %clay-take-inserting-unexpected-made +>.$
?. =(~ ins.u.dok)
~& %clay-take-inserting-redundant-made +>.$
=- =. ins.u.dok `-
?: ?& ?=(^ dif.u.dok)
?=(^ mut.u.dok)
==
(apply-edit wen)
+>.$
^- (list (pair path cage))
%+ turn (tage-to-cages (made-to-tage res))
|= [pax=cage cay=cage]
?. ?=(%path p.pax)
~|(%clay-take-inserting-strange-path-mark !!)
[((hard path) q.q.pax) cay]
2015-02-27 09:35:41 +03:00
::
2015-04-15 03:48:37 +03:00
++ take-diffing
|= [wen=@da res=(each gage tang)]
2015-02-27 09:35:41 +03:00
^+ +>
?~ dok
2015-04-15 03:48:37 +03:00
~& %clay-take-diffing-unexpected-made +>.$
2015-04-17 03:22:39 +03:00
?. =(~ dif.u.dok)
2015-04-15 03:48:37 +03:00
~& %clay-take-diffing-redundant-made +>.$
=- =. dif.u.dok `-
?: ?& ?=(^ ins.u.dok)
?=(^ mut.u.dok)
==
(apply-edit wen)
+>.$
^- (list (trel path lobe cage))
2015-04-17 03:22:39 +03:00
%+ turn (tage-to-cages (made-to-tage res))
2015-04-15 03:48:37 +03:00
|= [pax=cage cay=cage]
2015-04-17 03:22:39 +03:00
^- (pair path (pair lobe cage))
2015-04-15 03:48:37 +03:00
?. ?=(%path p.pax)
~|(%clay-take-diffing-strange-path-mark !!)
=+ paf=((hard path) q.q.pax)
[paf (page-to-lobe:ze [p q.q]:cay) (~(got by dig.u.dok) paf)]
::
++ take-mutating
|= [wen=@da res=(each gage tang)]
2015-04-15 03:48:37 +03:00
^+ +>
?~ dok
~& %clay-take-mutating-unexpected-made +>.$
2015-04-17 03:22:39 +03:00
?. =(~ mut.u.dok)
2015-04-15 03:48:37 +03:00
~& %clay-take-mutating-redundant-made +>.$
=- =. mut.u.dok `-
?: ?& ?=(^ ins.u.dok)
?=(^ dif.u.dok)
==
(apply-edit wen)
+>.$
^- (list (trel path lobe cage))
%+ murn (tage-to-cages (made-to-tage res))
|= [pax=cage cay=cage]
^- (unit (pair path (pair lobe cage)))
?. ?=(%path p.pax)
~|(%clay-take-mutating-strange-path-mark !!)
?: ?=(%null p.cay)
~
=+ paf=((hard path) q.q.pax)
2015-04-17 03:22:39 +03:00
`[paf (~(got by muh.u.dok) paf) cay]
2015-02-27 09:35:41 +03:00
::
++ take-patch
|= res=(each gage tang)
2015-02-27 09:35:41 +03:00
^+ +>
2015-04-14 00:29:39 +03:00
:: ~& %taking-patch
2015-03-11 00:09:53 +03:00
?: ?=(%| -.res)
2015-02-27 09:35:41 +03:00
%_ +>.$
dok ~
yel
[[hen %note '!' %rose [" " "" ""] leaf/"clay patch failed" p.res] yel]
==
2015-04-14 00:29:39 +03:00
:: ~& %editing
2015-04-17 03:22:39 +03:00
=+ ^- sim=(list (pair path misu))
?~ dok
~|(%no-changes !!)
?> ?=(^ ins.u.dok)
?> ?=(^ dif.u.dok)
?> ?=(^ mut.u.dok)
;: welp
^- (list (pair path misu))
(turn del.u.dok |=([pax=path cay=cage] [pax %del cay]))
::
^- (list (pair path misu))
(turn ink.u.dok |=([pax=path cay=cage] [pax %ins cay]))
::
^- (list (pair path misu))
(turn u.ins.u.dok |=([pax=path cay=cage] [pax %ins cay]))
::
^- (list (pair path misu))
(turn u.dif.u.dok |=([pax=path cal=[lobe cage]] [pax %dif cal]))
::
^- (list (pair path misu))
(turn u.mut.u.dok |=([pax=path cal=[lobe cage]] [pax %dif cal]))
==
=^ hat +>.$ (edit:ze now %& *cart sim) :: XX we do same thing in ++apply-edit
2015-04-14 00:29:39 +03:00
:: ~& %edited
2015-02-27 09:35:41 +03:00
=. +>.$ wake
2015-04-14 00:29:39 +03:00
:: ~& %woked
2015-02-27 09:35:41 +03:00
?~ dok ~& %no-dok +>.$
=>
%= .
+>.$
2015-04-17 03:22:39 +03:00
?< ?=(~ hat) :: XX whut?
(echo now %& *cart sim)
2015-02-27 09:35:41 +03:00
==
?~ dok ~& %no-dok +>.$
=+ cay=p.res
2015-02-27 09:35:41 +03:00
?@ p.cay ~| %patch-bad-marc !!
2015-04-14 00:29:39 +03:00
:: ~& %canning
2015-02-27 09:35:41 +03:00
=+ ^= can
|- ^- (list ,[path cage])
?~ p.p.cay
~
:_ %_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?. ?=(%path p.i.p.p.cay)
~| %patch-strange-marc-a
!!
?. ?=(@ q.i.p.p.cay)
~| %patch-strange-marc-b
!!
=+ coy=(slot 2 q.cay)
?@ q.coy
~| %patch-strange-coy
!!
:- ((hard path) -.q.coy)
[q.i.p.p.cay (slot 3 coy)]
2015-04-14 00:29:39 +03:00
:: ~& %canned
:: ~& %checking-out
2015-02-27 09:35:41 +03:00
=. ank.dom (checkout-ankh:ze (mo can))
2015-04-14 00:29:39 +03:00
:: ~& %checked-out
2015-02-27 09:35:41 +03:00
?~ hez +>.$(dok ~)
=+ ^= ceq
|= a=miso
?| ?=(%del -.a)
&(?=(%ins -.a) ?=(%mime -.+.a))
&(?=(%mut -.a) ?=(%mime -.+>.a))
==
2015-04-14 00:29:39 +03:00
:: ~& %forming-ergo
:: =- ~& %formed-ergo -
2015-02-27 09:35:41 +03:00
%_ +>.$
dok ~
tag :: ?~(hez reg :_(reg [u.hez [%ergo who syd let.dom]]))
:_ tag
2015-04-17 03:22:39 +03:00
:* hen %pass [%ergoing (scot %p who) syd ~] %f
2015-04-14 03:29:54 +03:00
%exec who [who syd %da now] ~ %tabl
^- (list (pair silk silk))
2015-04-17 03:22:39 +03:00
%+ turn sim
2015-04-14 03:29:54 +03:00
|= [a=path b=misu]
^- (pair silk silk)
:- [%done ~ %path !>(a)]
?: ?=(%del -.b)
[%done ~ %null !>(~)]
=+ (~(get by mim.u.dok) a)
2015-04-18 02:21:54 +03:00
?^ - [%done ~ %mime !>(u.-)]
2015-04-14 03:29:54 +03:00
:^ %cast %mime %done :- ~
(need (read:ze %x [%ud let.dom] a))
==
2015-02-27 09:35:41 +03:00
==
::
++ take-ergo
|= res=(each gage tang)
2015-02-27 09:35:41 +03:00
^+ +>
?: ?=(%| -.res)
%_ +>.$
yel
[[hen %note '!' %rose [" " "" ""] leaf/"clay ergo failed" p.res] yel]
==
?~ hez ~& %no-sync-duct !!
=+ cay=p.res
2015-02-27 09:35:41 +03:00
?@ p.cay ~| %patch-bad-marc !!
%= +>.$
reg
:_ reg
:* u.hez %ergo who syd let.dom
|- ^- (list ,[path (unit mime)])
?~ p.p.cay
~
:_ %_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?. ?=(%path p.i.p.p.cay)
~| %ergo-strange-marc-a
!!
?. ?=(@ q.i.p.p.cay)
~| %ergo-strange-marc-b
!!
=+ coy=(slot 2 q.cay)
?@ q.coy
~| %ergo-strange-coy
!!
:- ((hard path) -.q.coy)
?. ?=(%mime q.i.p.p.cay)
~
`((hard mime) q:(slot 3 coy))
==
==
::
2015-03-11 02:56:08 +03:00
++ checkout-ankh
2015-02-27 09:35:41 +03:00
|= hat=(map path lobe)
^+ +>
2015-03-11 02:56:08 +03:00
%_ +>.$
tag
:_ tag
2015-04-14 03:29:54 +03:00
:* hen %pass [%patching (scot %p who) syd ~] %f
%exec who [who syd %da now] :+ ~ %tabl
^- (list (pair silk silk))
%+ turn (~(tap by hat))
|= [a=path b=lobe]
^- (pair silk silk)
:- [%done ~ %path !>(a)]
(lobe-to-silk:ze a b)
==
2015-02-27 09:35:41 +03:00
==
::
2015-03-04 04:05:41 +03:00
++ apply-foreign-update :: apply subscription
|= $: gar=(map aeon tako) :: new ids
let=aeon :: next id
lar=(set yaki) :: new commits
bar=(set blob) :: new content
==
2015-02-27 09:35:41 +03:00
^+ +>
%= +>
2015-03-11 22:43:44 +03:00
hit.dom (~(uni by hit.dom) gar)
2015-03-07 00:07:34 +03:00
let.dom let
2015-03-11 22:43:44 +03:00
hut.ran %- ~(uni by hut.ran)
2015-03-07 00:07:34 +03:00
%- mo ^- (list (pair tako yaki))
%+ turn (~(tap in lar))
|= yak=yaki
[r.yak yak]
lat.ran %- ~(uni by lat.ran)
%- mo ^- (list (pair lobe blob))
%+ turn (~(tap in bar))
|= bol=blob
[p.bol bol]
2015-02-27 09:35:41 +03:00
==
::
++ exec :: change and update
|= [wen=@da lem=nori]
^+ +>
wake:(edit wen lem)
::
++ exem :: execute merge
|= [wen=@da her=@p sud=@tas gem=germ] :: aka direct change
!!
:: ?. (gte p.mer let.dom) !! :: no
:: =. +>.$ %= +>.$
:: hut.ran (~(uni by hut.r.mer) hut.ran)
:: lat.ran (~(uni by lat.r.mer) lat.ran)
:: let.dom p.mer
:: hit.dom (~(uni by q.mer) hit.dom)
:: ==
:: =+ ^= hed :: head commit
:: =< q
:: %- ~(got by hut.ran)
:: %- ~(got by hit.dom)
:: let.dom
:: (echa:wake:(checkout-ankh hed))
::
2015-03-04 04:05:41 +03:00
++ take-foreign-update :: external change
2015-03-05 03:36:29 +03:00
|= [inx=@ud rut=(unit rand)]
2015-02-27 09:35:41 +03:00
^+ +>
?> ?=(^ ref)
|- ^+ +>+.$
=+ ruv=(~(get by bom.u.ref) inx)
?~ ruv +>+.$
2015-03-27 02:26:39 +03:00
=> ?. |(?=(~ rut) ?=(%sing -.q.u.ruv)) .
2015-02-27 09:35:41 +03:00
%_ .
bom.u.ref (~(del by bom.u.ref) inx)
fod.u.ref (~(del by fod.u.ref) p.u.ruv)
==
2015-03-05 03:36:29 +03:00
?~ rut
2015-02-27 09:35:41 +03:00
=+ rav=`rave`q.u.ruv
%= +>+.$
lim
2015-03-27 02:26:39 +03:00
?.(&(?=(%many -.rav) ?=(%da -.q.q.rav)) lim `@da`p.q.q.rav)
2014-10-17 00:42:45 +04:00
::
2015-02-27 09:35:41 +03:00
haw.u.ref
2015-03-27 02:26:39 +03:00
?. ?=(%sing -.rav) haw.u.ref
2015-02-27 09:35:41 +03:00
(~(put by haw.u.ref) p.rav ~)
2013-09-29 00:21:18 +04:00
==
2015-03-05 03:36:29 +03:00
?- p.p.u.rut
%u
~| %im-thinkin-its-prolly-a-bad-idea-to-request-rang-over-the-network
!!
::
%v
~| %weird-we-shouldnt-get-a-dome-request-over-the-network
!!
::
%x
=< ?> ?=(^ ref) .
(rand-to-rant u.rut)
::
%w
=. haw.u.ref
%+ ~(put by haw.u.ref)
[p.p.u.rut q.p.u.rut q.u.rut]
:+ ~
p.r.u.rut
?+ p.r.u.rut ~| %strange-w-over-nextwork !!
%aeon !>(((hard aeon) q.r.u.rut))
2015-03-27 02:26:39 +03:00
%null [[%atom %n] ~]
2015-03-14 00:47:29 +03:00
%nako !>(~|([%harding [&1 &2 &3]:q.r.u.rut] ((hard nako) q.r.u.rut)))
2015-03-05 03:36:29 +03:00
==
?. ?=(%nako p.r.u.rut) +>+.$
|- ^+ +>+.^$
=+ nez=[%w [%ud let.dom] ~]
=+ nex=(~(get by haw.u.ref) nez)
?~ nex +>+.^$
?~ u.nex +>+.^$ :: should never happen
=. nak.u.ref `((hard nako) q.q.u.u.nex)
=. +>+.^$
2015-03-11 22:43:44 +03:00
?: =(0 let.dom)
=> (apply-foreign-update (need nak.u.ref))
?>(?=(^ ref) .)
2015-03-19 22:34:25 +03:00
=> (validate-plops [%ud let.dom] bar:(need nak.u.ref))
2015-03-11 22:43:44 +03:00
?>(?=(^ ref) .)
2015-03-05 03:36:29 +03:00
%= $
haw.u.ref (~(del by haw.u.ref) nez)
==
::
%y
%_ +>+.$
haw.u.ref
%+ ~(put by haw.u.ref)
[p.p.u.rut q.p.u.rut q.u.rut]
`[p.r.u.rut !>(((hard arch) q.r.u.rut))]
==
::
%z
~| %its-prolly-reasonable-to-request-ankh-over-the-network-sorry
!!
2015-02-27 09:35:41 +03:00
==
::
2015-03-05 03:36:29 +03:00
++ rand-to-rant
|= rut=rand
^+ +>
~| [%x-over-network-not-implemented [p q -.r]:rut hen] !!
2015-03-05 03:36:29 +03:00
:: =- %_(+>.$ tag [- tag])
:: :* hen
:: [%foreign-plops (scot %p who) (scot %p for) syd ~]
:: %f %exec who ~ %tabl
:: ^- (list (pair silk silk))
:: %+ turn (~(tap in pop))
:: |= a=plop
:: ?- -.a
:: %delta
:: :- [%done ~ %blob !>([%delta p.a q.a *cage])]
:: [%vale p.r.a him q.r.a]
:: ::
:: %direct
:: :- [%done ~ %blob !>([%direct p.a *cage])]
:: [%vale p.q.a him q.q.a]
:: ::
:: %indirect ~| %foreign-indirect-not-implemented !!
:: ==
:: ==
::
2015-03-04 04:05:41 +03:00
++ validate-plops
2015-03-19 22:34:25 +03:00
|= [cas=case pop=(set plop)]
2015-03-04 04:05:41 +03:00
^+ +>
=- %_(+>.$ tag [- tag])
2015-04-14 03:29:54 +03:00
:* hen %pass
2015-03-04 04:05:41 +03:00
[%foreign-plops (scot %p who) (scot %p for) syd ~]
2015-03-19 22:34:25 +03:00
%f %exec who [for syd cas] ~ %tabl
2015-03-04 04:05:41 +03:00
^- (list (pair silk silk))
%+ turn (~(tap in pop))
|= a=plop
?- -.a
%delta
2015-03-11 02:56:08 +03:00
:- [%done ~ %blob !>([%delta p.a q.a *page])]
2015-03-19 22:34:25 +03:00
[%vale p.r.a for q.r.a]
2015-03-04 04:05:41 +03:00
::
%direct
2015-03-11 02:56:08 +03:00
:- [%done ~ %blob !>([%direct p.a *page])]
2015-03-19 22:34:25 +03:00
[%vale p.q.a for q.q.a]
2015-03-04 04:05:41 +03:00
::
%indirect ~| %foreign-indirect-not-implemented !!
==
==
::
++ take-foreign-plops
|= res=(each gage tang)
2015-03-04 04:05:41 +03:00
^+ +>
?> ?=(^ ref)
?> ?=(^ nak.u.ref)
?: ?=(%| -.res)
2015-03-07 00:07:34 +03:00
~| "validate foreign plops failed"
2015-03-11 00:09:53 +03:00
~| [%plop-fail (turn p.res |=(tank ~(ram re +<)))]
2015-03-07 00:07:34 +03:00
!!
=+ cay=p.res
2015-03-04 04:05:41 +03:00
?@ p.cay ~| %plop-bad-marc !!
=+ |- ^- lat=(list blob)
?~ p.p.cay
~
:_ %_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?. ?=(%blob p.i.p.p.cay)
~| %plop-strange-marc-a
!!
?. ?=(@ q.i.p.p.cay)
~| %plop-strange-marc-b
!!
=+ coy=(slot 2 q.cay)
?@ q.coy
~| %plop-strange-coy
!!
=+ bol=((hard blob) -.q.coy)
?- -.bol
%delta [-.bol p.bol q.bol q.i.p.p.cay +.q.coy]
%direct [-.bol p.bol q.i.p.p.cay +.q.coy]
2015-03-04 04:05:41 +03:00
%indirect ~| %plop-indirect-not-implemented !!
==
%^ apply-foreign-update
gar.u.nak.u.ref
let.u.nak.u.ref
[lar.u.nak.u.ref (sa lat)]
::
2015-02-27 09:35:41 +03:00
++ mabe :: maybe fire function
|* [rov=rove fun=$+(@da _+>.^$)]
^+ +>.$
%- fall :_ +>.$
%- bind :_ fun
^- (unit ,@da)
?- -.rov
2015-03-27 02:26:39 +03:00
%sing
2015-02-27 09:35:41 +03:00
?. ?=(%da -.q.p.rov) ~
`p.q.p.rov
2015-03-27 02:26:39 +03:00
%many
=* mot q.rov
2015-02-27 09:35:41 +03:00
%+ hunt
?. ?=(%da -.p.mot) ~
?.((lth now p.p.mot) ~ [~ p.p.mot])
?. ?=(%da -.q.mot) ~
?.((lth now p.q.mot) [~ now] [~ p.q.mot])
==
::
++ reve
|= rov=rove
^- rave
2015-03-27 02:26:39 +03:00
?: ?=(%sing -.rov) rov
[%many p.rov p.q.rov q.q.rov r.q.rov]
2015-02-27 09:35:41 +03:00
::
++ rive
2015-03-27 02:26:39 +03:00
|= rav=[%many p=? q=moat]
2015-02-27 09:35:41 +03:00
^- rove
2015-03-27 02:26:39 +03:00
[%many p.rav p.q.rav q.q.rav r.q.rav ~]
2015-02-27 09:35:41 +03:00
::
++ wake :: update subscribers
^+ .
=+ xiq=(~(tap by qyx) ~)
=| xaq=(list ,[p=duct q=rove])
|- ^+ ..wake
?~ xiq
..wake(qyx (~(gas by *cult) xaq))
?- -.q.i.xiq
2015-03-27 02:26:39 +03:00
%sing
2015-02-27 09:35:41 +03:00
=+ cas=?~(ref ~ (~(get by haw.u.ref) `mood`p.q.i.xiq))
?^ cas
%= $
xiq t.xiq
..wake ?~ u.cas (blub p.i.xiq)
2015-03-31 01:12:18 +03:00
(blab p.i.xiq p.q.i.xiq %& u.u.cas)
2015-02-27 09:35:41 +03:00
==
=+ nao=(case-to-aeon:ze q.p.q.i.xiq)
?~ nao $(xiq t.xiq, xaq [i.xiq xaq])
2015-04-14 00:29:39 +03:00
:: ~& %reading-at-aeon
=+ vid=(read-at-aeon:ze u.nao p.q.i.xiq)
2015-04-14 00:29:39 +03:00
:: ~& %red-at-aeon
?~ vid ~& [%oh-well mood=p.q.i.xiq aeon=nao] $(xiq t.xiq, xaq [i.xiq xaq])
$(xiq t.xiq, ..wake (balk p.i.xiq u.vid p.q.i.xiq))
2013-09-29 00:21:18 +04:00
::
2015-03-27 02:26:39 +03:00
%many
=+ mot=`moot`q.q.i.xiq
2015-02-27 09:35:41 +03:00
=+ nab=(case-to-aeon:ze p.mot)
?~ nab
$(xiq t.xiq, xaq [i.xiq xaq])
=+ huy=(case-to-aeon:ze q.mot)
?~ huy
=+ ptr=[%ud +(let.dom)]
%= $
xiq t.xiq
2015-03-27 02:26:39 +03:00
xaq [[p.i.xiq [%many p.q.i.xiq ptr q.mot r.mot s.mot]] xaq]
2015-02-27 09:35:41 +03:00
..wake =+ ^= ear
2015-03-27 02:26:39 +03:00
(lobes-at-path:ze let.dom r.mot)
?: =(s.mot ear) ..wake
(bleb p.i.xiq let.dom ?:(p.q.i.xiq ~ `[u.nab let.dom]))
2015-02-27 09:35:41 +03:00
==
%= $
xiq t.xiq
..wake =- (blub:- p.i.xiq)
=+ ^= ear
2015-03-27 02:26:39 +03:00
(lobes-at-path:ze u.huy r.mot)
?: =(s.mot ear) (blub p.i.xiq)
(bleb p.i.xiq +(u.nab) ?:(p.q.i.xiq ~ `[u.nab u.huy]))
2015-02-27 09:35:41 +03:00
==
==
++ ze
|%
++ aeon-to-tako ~(got by hit.dom)
++ aeon-to-yaki (cork aeon-to-tako tako-to-yaki)
2015-03-07 00:07:34 +03:00
++ lobe-to-blob ~(got by lat.ran)
2015-02-27 09:35:41 +03:00
++ tako-to-yaki ~(got by hut.ran)
2015-03-11 00:09:53 +03:00
++ lobe-to-mark
2015-02-27 09:35:41 +03:00
|= a=lobe
2015-03-11 00:09:53 +03:00
=> (lobe-to-blob a)
?- -
%delta p.q
%direct p.q
%indirect p.q
==
++ lobe-to-silk
2015-03-19 00:25:01 +03:00
|= [pax=path lob=lobe]
^- silk
=+ ^- hat=(map path lobe)
?: =(let.dom 0)
~
q:(aeon-to-yaki let.dom)
2015-04-09 03:51:34 +03:00
=+ lol=`(unit lobe)`?.(=(~ ref) `0vsen.tinel (~(get by hat) pax))
2015-02-27 09:35:41 +03:00
|- ^- silk
2015-04-07 02:20:28 +03:00
?: =([~ lob] lol)
2015-03-31 01:12:18 +03:00
=+ (need (need (read-x let.dom pax)))
?> ?=(%& -<)
[%done ~ p.-]
2015-03-19 00:25:01 +03:00
=+ bol=(~(got by lat.ran) lob)
?- -.bol
%direct [%volt ~ q.bol]
%indirect [%volt ~ q.bol]
2015-03-19 00:25:01 +03:00
%delta [%pact $(lob q.q.bol) [%volt ~ r.bol]]
2015-03-04 04:05:41 +03:00
==
::
2015-04-17 03:22:39 +03:00
++ page-to-lobe |=(* (shax (jam +<)))
2015-02-27 09:35:41 +03:00
++ make-direct :: make blob
2015-03-11 02:56:08 +03:00
|= p=page
2015-02-27 09:35:41 +03:00
^- blob
2015-04-15 03:48:37 +03:00
[%direct (page-to-lobe p) p]
2015-02-27 09:35:41 +03:00
::
++ make-delta :: make blob delta
2015-04-21 23:23:50 +03:00
|= [p=lobe q=[p=mark q=lobe] r=page]
2015-02-27 09:35:41 +03:00
^- blob
2015-04-21 23:23:50 +03:00
[%delta p q r]
2015-02-27 09:35:41 +03:00
::
++ make-yaki :: make yaki
|= [p=(list tako) q=(map path lobe) t=@da]
^- yaki
=+ ^= has
%^ cat 7 (sham [%yaki (roll p add) q t])
(sham [%tako (roll p add) q t])
[p q has t]
::
++ apply-changes :: apply-changes:ze
|= lar=(list ,[p=path q=misu]) :: store changes
^- (map path blob)
=+ ^= hat :: current state
?: =(let.dom 0) :: initial commit
~ :: has nothing
=< q
%- aeon-to-yaki
let.dom
=- =+ sar=(sa (turn lar |=([p=path *] p))) :: changed paths
%+ roll (~(tap by hat) ~) :: find unchanged
=< .(bat bar)
2015-03-11 02:56:08 +03:00
|= [[pax=path gar=lobe] bat=(map path blob)]
?: (~(has in sar) pax) :: has update
2015-02-27 09:35:41 +03:00
bat
2015-03-11 02:56:08 +03:00
%+ ~(put by bat) pax
~| [pax gar (lent (~(tap by lat.ran)))]
2015-03-11 00:09:53 +03:00
(lobe-to-blob gar) :: use original
2015-02-27 09:35:41 +03:00
^= bar ^- (map path blob)
%+ roll lar
2015-03-11 02:56:08 +03:00
|= [[pax=path mys=misu] bar=(map path blob)]
2015-02-27 09:35:41 +03:00
^+ bar
?- -.mys
%ins :: insert if not exist
2015-03-11 02:56:08 +03:00
?: (~(has by bar) pax) !! ::
?: (~(has by hat) pax) !! ::
%+ ~(put by bar) pax
2015-02-27 09:35:41 +03:00
%- make-direct
2015-03-11 02:56:08 +03:00
?: &(?=(%mime -.p.mys) =([%hook ~] (slag (dec (lent pax)) pax)))
`page`[%hook +.+.q.q.p.mys]
?: &(?=(%mime -.p.mys) =([%hoon ~] (slag (dec (lent pax)) pax)))
`page`[%hoon +.+.q.q.p.mys]
2015-03-11 03:54:39 +03:00
[p q.q]:p.mys
2015-02-27 09:35:41 +03:00
%del :: delete if exists
2015-03-11 02:56:08 +03:00
?. |((~(has by hat) pax) (~(has by bar) pax)) !!
(~(del by bar) pax)
2015-02-27 09:35:41 +03:00
%dif :: mutate, must exist
2015-03-11 02:56:08 +03:00
=+ ber=(~(get by bar) pax) :: XX typed
2015-03-11 00:09:53 +03:00
=+ for==>((flop pax) ?~(. %$ i))
2015-02-27 09:35:41 +03:00
?~ ber
2015-03-11 02:56:08 +03:00
=+ har=(~(get by hat) pax)
2015-02-27 09:35:41 +03:00
?~ har !!
2015-03-11 02:56:08 +03:00
%+ ~(put by bar) pax
2015-04-21 23:23:50 +03:00
(make-delta p.mys [(lobe-to-mark u.har) u.har] [p q.q]:q.mys)
2015-03-11 02:56:08 +03:00
:: XX check vase !evil
%+ ~(put by bar) pax
2015-04-21 23:23:50 +03:00
(make-delta p.mys [(lobe-to-mark p.u.ber) p.u.ber] [p q.q]:q.mys)
2015-03-11 02:56:08 +03:00
:: XX check vase !evil
2013-10-08 04:40:45 +04:00
==
::
2015-02-27 09:35:41 +03:00
++ as-arch
^- arch
:+ p.ank.dom
?~(q.ank.dom ~ [~ p.u.q.ank.dom])
|- ^- (map ,@ta ,~)
?~ r.ank.dom ~
[[p.n.r.ank.dom ~] $(r.ank.dom l.r.ank.dom) $(r.ank.dom r.r.ank.dom)]
::
++ case-to-aeon :: case-to-aeon:ze
|= lok=case :: act count through
^- (unit aeon)
?- -.lok
%da
?: (gth p.lok lim) ~
|- ^- (unit aeon)
?: =(0 let.dom) [~ 0] :: avoid underflow
2015-03-11 00:09:53 +03:00
?: %+ gte p.lok
2015-02-27 09:35:41 +03:00
=< t
2015-03-07 00:07:34 +03:00
~| [%letdom let=let.dom hit=hit.dom hut=(~(run by hut.ran) ,~)]
~| [%getdom (~(get by hit.dom) let.dom)]
2015-02-27 09:35:41 +03:00
%- aeon-to-yaki
let.dom
[~ let.dom]
$(let.dom (dec let.dom))
2013-09-29 00:21:18 +04:00
::
2015-02-27 09:35:41 +03:00
%tas (~(get by lab.dom) p.lok)
%ud ?:((gth p.lok let.dom) ~ [~ p.lok])
2014-05-30 06:12:02 +04:00
==
::
2015-02-27 09:35:41 +03:00
++ checkout-ankh
|= hat=(map path cage)
^- ankh
%- cosh
%+ roll (~(tap by hat) ~)
|= [[pat=path zar=cage] ank=ankh]
^- ankh
%- cosh
?~ pat
ank(q [~ (sham q.q.zar) zar])
=+ nak=(~(get by r.ank) i.pat)
%= ank
2015-03-11 00:09:53 +03:00
r %+ ~(put by r.ank) i.pat
2015-02-27 09:35:41 +03:00
$(pat t.pat, ank (fall nak *ankh))
2014-07-24 19:47:11 +04:00
==
::
2015-02-27 09:35:41 +03:00
++ cosh
|= ank=ankh
%_ ank
p
^- cash
%+ mix ?~(q.ank 0 p.u.q.ank)
=+ axe=1
|- ^- cash
?~ r.ank *@
;: mix
(shaf %dash (mix axe (shaf %dush (mix p.n.r.ank p.q.n.r.ank))))
$(r.ank l.r.ank, axe (peg axe 2))
$(r.ank r.r.ank, axe (peg axe 3))
2013-09-29 00:21:18 +04:00
==
2014-05-30 06:12:02 +04:00
==
::
2015-02-27 09:35:41 +03:00
++ edit :: edit:ze
|= [wen=@da lem=nuri] :: edit
^- [(unit (map path lobe)) _..ze]
?- -.lem
& =^ yak lat.ran :: merge objects
%+ forge-yaki wen
?: =(let.dom 0) :: initial import
[~ p.lem]
[(some r:(aeon-to-yaki let.dom)) p.lem]
?. ?| =(0 let.dom)
!=((lent p.yak) 1)
!(equiv q.yak q:(aeon-to-yaki let.dom))
==
`..ze :: silently ignore
=: let.dom +(let.dom)
hit.dom (~(put by hit.dom) +(let.dom) r.yak)
hut.ran (~(put by hut.ran) r.yak yak)
==
[`q.yak ..ze]
:: +>.$(ank (checkout-ankh q.yak))
| ?< (~(has by lab.dom) p.lem)
[~ ..ze(lab.dom (~(put by lab.dom) p.lem let.dom))]
2014-07-22 22:56:04 +04:00
==
2014-05-30 06:12:02 +04:00
::
2015-02-27 09:35:41 +03:00
++ equiv :: test paths
|= [p=(map path lobe) q=(map path lobe)]
^- ?
=- ?. qat %.n
%+ levy (~(tap by q) ~)
|= [pat=path lob=lobe]
(~(has by p) pat)
^= qat
%+ levy (~(tap by p) ~)
|= [pat=path lob=lobe]
=+ zat=(~(get by q) pat)
?~ zat %.n
=(u.zat lob)
:: =((lobe-to-cage u.zat) (lobe-to-cage lob))
::
++ forge-nori :: forge-nori:ze
|= yak=yaki :: forge nori
^- nori
!!
:: ?~ p.yak !! :: no parent, no diff
:: :+ %& *cart :: diff w/ 1st parent
:: (~(tap by (diff-yakis (tako-to-yaki i.p.yak) yak)) ~)
::
++ forge-yaki :: forge-yaki:ze
|= [wen=@da par=(unit tako) lem=suba] :: forge yaki
=+ ^= per
?~ par ~
~[u.par]
=+ gar=(update-lat (apply-changes q.lem) lat.ran)
2015-04-15 03:48:37 +03:00
:- (make-yaki per +.gar wen) :: from existing diff
2015-02-27 09:35:41 +03:00
-.gar :: fix lat
::
++ lobes-at-path :: lobes-at-path:ze
|= [yon=aeon pax=path] :: data at path
^- (map path lobe)
?: =(0 yon) ~
%- mo
%+ skim
%. ~
%~ tap by
=< q
%- aeon-to-yaki
yon
|= [p=path q=lobe]
?| ?=(~ pax)
?& !?=(~ p)
=(-.pax -.p)
$(p +.p, pax +.pax)
== ==
::
2015-03-06 04:19:54 +03:00
++ make-nako
2015-02-27 09:35:41 +03:00
|= [a=aeon b=aeon]
2015-03-04 04:05:41 +03:00
^- nako
2015-03-06 04:19:54 +03:00
:+ hit.dom
let.dom
(data-twixt-takos (~(get by hit.dom) a) (aeon-to-tako b))
2014-05-30 06:12:02 +04:00
::
2015-02-27 09:35:41 +03:00
++ query :: query:ze
|= ren=?(%u %v %x %y %z) :: endpoint query
^- (unit cage)
?- ren
%u [~ %rang !>(ran)]
%v [~ %dome !>(dom)]
%x ?~(q.ank.dom ~ [~ q.u.q.ank.dom])
%y [~ %arch !>(as-arch)]
%z [~ %ankh !>(ank.dom)]
2014-10-17 00:42:45 +04:00
==
::
2015-03-20 22:20:17 +03:00
++ new-lobes :: object hash set
|= [b=(set lobe) a=(set tako)] :: that aren't in b
^- (set lobe)
%+ roll (~(tap in a) ~)
|= [tak=tako bar=(set lobe)]
^- (set lobe)
=+ yak=(tako-to-yaki tak)
%+ roll (~(tap by q.yak) ~)
=< .(far bar)
|= [[path lob=lobe] far=(set lobe)]
^- (set lobe)
?~ (~(has in b) lob) :: don't need
far
=+ gar=(lobe-to-blob lob)
?- -.gar
%direct (~(put in far) lob)
%delta (~(put in $(lob q.q.gar)) lob)
%indirect (~(put in $(lob r.gar)) lob)
==
::
2015-03-06 04:19:54 +03:00
++ data-twixt-takos
2015-03-11 00:09:53 +03:00
|= [a=(unit tako) b=tako]
2015-03-07 00:07:34 +03:00
^- [(set yaki) (set plop)]
2015-03-20 22:20:17 +03:00
=+ old=?~(a ~ (reachable-takos u.a))
=+ ^- yal=(set tako)
%- sa
%+ skip
(~(tap in (reachable-takos b)))
|=(tak=tako (~(has in old) tak))
:- (sa (turn (~(tap in yal)) tako-to-yaki))
(sa (turn (~(tap in (new-lobes (new-lobes ~ old) yal))) lobe-to-blob))
2015-03-06 04:19:54 +03:00
::
2015-02-27 09:35:41 +03:00
++ reachable-takos :: reachable
|= p=tako :: XX slow
^- (set tako)
=+ y=(tako-to-yaki p)
=+ t=(~(put in *(set tako)) p)
%+ roll p.y
=< .(s t)
|= [q=tako s=(set tako)]
?: (~(has in s) q) :: already done
s :: hence skip
(~(uni in s) ^$(p q)) :: otherwise traverse
::
++ read :: read:ze
|= mun=mood :: read at point
^- (unit cage)
?: ?=(%v p.mun)
[~ %dome !>(dom)]
?: &(?=(%w p.mun) !?=(%ud -.q.mun))
?^(r.mun ~ [~ %aeon !>(let.dom)])
?: ?=(%w p.mun)
=+ ^= yak
%- aeon-to-yaki
let.dom
?^(r.mun ~ [~ %w !>([t.yak (forge-nori yak)])])
(query(ank.dom ank:(descend-path:(zu ank.dom) r.mun)) p.mun)
::
++ read-x
|= [yon=aeon pax=path]
2015-03-31 01:12:18 +03:00
^- (unit (unit (each cage silk)))
2015-03-14 00:47:29 +03:00
=+ tak=(~(get by hit.dom) yon)
?~ tak
~
2015-03-31 22:52:47 +03:00
?: &(?=(~ ref) =(yon let.dom))
2015-03-31 01:12:18 +03:00
`(bind q.ank:(descend-path:(zu ank.dom) pax) (corl (cury same %&) tail))
2015-03-14 00:47:29 +03:00
=+ yak=(tako-to-yaki u.tak)
=+ lob=(~(get by q.yak) pax)
?~ lob
[~ ~]
=+ mar=(lobe-to-mark u.lob)
?. ?=(?(%hoon %hook) mar)
2015-03-31 01:12:18 +03:00
[~ ~ %| (lobe-to-silk pax u.lob)]
2015-03-31 22:52:47 +03:00
:^ ~ ~ %&
2015-03-31 01:12:18 +03:00
:+ mar [%atom %t]
|- ^- @t :: (urge cord) would be faster
=+ bol=(lobe-to-blob u.lob)
?: ?=(%direct -.bol)
((hard ,@t) q.q.bol)
?: ?=(%indirect -.bol)
((hard ,@t) q.q.bol)
?> ?=(%delta -.bol)
=+ txt=$(u.lob q.q.bol)
?> ?=(%txt-diff p.r.bol)
=+ dif=((hard (urge cord)) q.r.bol)
=+ pac=(role (lurk (lore (cat 3 txt '\0a')) dif))
(end 3 (dec (met 3 pac)) pac)
::
++ read-y
|= [yon=aeon pax=path]
^- (unit (unit (cask (hypo arch))))
2015-03-14 00:47:29 +03:00
=+ tak=(~(get by hit.dom) yon)
?~ tak
~
=+ yak=(tako-to-yaki u.tak)
=+ len=(lent pax)
:^ ~ ~ %arch
:- -:!>(*arch)
^- arch
:+ *@uvI
?.((~(has by q.yak) pax) ~ `0vfak.ehash) :: XX hash of lobes
^- (map span ,~)
%- mo ^- (list (pair span ,~))
%+ turn
%+ skim (~(tap by (~(del by q.yak) pax)))
|= [paf=path lob=lobe]
=(pax (scag len paf))
|= [paf=path lob=lobe]
[(snag len paf) ~]
::
2015-02-27 09:35:41 +03:00
++ read-at-aeon :: read-at-aeon:ze
|= [yon=aeon mun=mood] :: seek and read
2015-03-31 01:12:18 +03:00
^- (unit (unit (each cage silk)))
2015-02-27 09:35:41 +03:00
?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB only for speed
2015-03-31 01:12:18 +03:00
?^(r.mun [~ ~] [~ ~ %& %aeon !>(yon)])
?: ?=(%x p.mun)
(read-x yon r.mun)
?: ?=(%y p.mun)
2015-03-31 01:12:18 +03:00
(bind (read-y yon r.mun) (curr bind (cury same %&)))
%+ bind
2015-02-27 09:35:41 +03:00
(rewind yon)
|= a=(unit ,_+>.$)
2015-03-31 01:12:18 +03:00
^- (unit (each cage silk))
?~ a
2015-03-31 01:12:18 +03:00
~
`(unit (each cage silk))`(bind (read:u.a mun) (cury same %&))
2015-02-27 09:35:41 +03:00
::
++ rewind :: rewind:ze
|= yon=aeon :: rewind to aeon
^- (unit (unit ,_+>))
?: =(let.dom yon) ``+>
?: (gth yon let.dom) !! :: don't have version
2015-02-27 09:35:41 +03:00
=+ hat=q:(aeon-to-yaki yon)
?: (~(any by hat) |=(a=lobe ?=(%delta [-:(lobe-to-blob a)])))
~
~
2015-03-11 02:56:08 +03:00
::=+ ^- (map path cage)
:: %- ~(run by hat)
:: |= a=lobe
:: =+ (lobe-to-blob a)
:: ?-(-.- %direct q.-, %indirect q.-, %delta !!)
::`+>.$(ank.dom (checkout-ankh -), let.dom yon)
2015-02-27 09:35:41 +03:00
::
++ update-lat :: update-lat:ze
|= [lag=(map path blob) sta=(map lobe blob)] :: fix lat
^- [(map lobe blob) (map path lobe)]
%+ roll (~(tap by lag) ~)
=< .(lut sta)
|= [[pat=path bar=blob] [lut=(map lobe blob) gar=(map path lobe)]]
?~ (~(has by lut) p.bar)
[lut (~(put by gar) pat p.bar)]
:- (~(put by lut) p.bar bar)
(~(put by gar) pat p.bar)
::
++ zu :: filesystem
|= ank=ankh :: filesystem state
=| ram=path :: reverse path into
|%
++ descend :: descend
|= lol=@ta
^+ +>
=+ you=(~(get by r.ank) lol)
+>.$(ram [lol ram], ank ?~(you [*cash ~ ~] u.you))
::
++ descend-path :: descend recursively
|= way=path
^+ +>
?~(way +> $(way t.way, +> (descend i.way)))
--
::
++ me :: merge ali into bob
|= ali=(pair ship desk) :: from
=+ bob=`(pair ship desk)`[who syd] :: to
=+ dat=(fall (~(get by mer) ali) *mery) :: merge data
=| don=? :: keep going
|%
++ abet
^+ ..me
2015-03-19 22:34:25 +03:00
?: don
2015-02-27 09:35:41 +03:00
..me(mer (~(put by mer) ali dat))
..me(mer (~(del by mer) ali), reg :_(reg [hen %mere gon.dat]))
::
++ route
|= [sat=term res=(each riot (each gage tang))]
2015-02-27 09:35:41 +03:00
^+ +>.$
?+ sat ~|((crip <[%bad-stage sat]>) !!)
%ali %- fetched-ali ?> ?=(%& -.res) p.res
%diff-ali %- diffed-ali ?> ?=(%| -.res) p.res
%diff-bob %- diffed-bob ?> ?=(%| -.res) p.res
%merge %- merged ?> ?=(%| -.res) p.res
2015-04-21 23:23:50 +03:00
%build %- built ?> ?=(%| -.res) p.res
2015-02-27 09:35:41 +03:00
%checkout %- checked-out ?> ?=(%| -.res) p.res
%ergo %- ergoed ?> ?=(%| -.res) p.res
2014-10-28 04:50:07 +03:00
==
2015-02-27 09:35:41 +03:00
::
++ start
|= gem=germ
^+ +>
?: (~(has by mer) ali)
(error:he %already-merging ~)
?: &(=(0 let.dom) !?=(%init gem))
(error:he %no-bob-desk ~)
=. gem.dat gem
=. cas.dat [%da now]
?: ?=(%init gem.dat)
fetch-ali
=+ (~(get by hit.dom) let.dom)
?~ -
(error:he %no-bob--version ~)
=+ (~(get by hut.ran) u.-)
?~ -
(error:he %no-bob-commit ~)
fetch-ali(bob.dat u.-)
::
++ fetch-ali
^+ .
=- %_(+ tag [- tag])
2015-04-14 03:29:54 +03:00
:* hen %pass
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %ali ~]
2015-02-27 09:35:41 +03:00
%c %warp [p.bob p.ali] q.ali
2015-03-27 02:26:39 +03:00
`[%sing %v cas.dat /]
2014-10-28 22:59:26 +03:00
==
2015-02-27 09:35:41 +03:00
::
++ fetched-ali
|= rot=riot
^+ +>
?~ rot
(error:he %bad-fetch-ali ~)
=+ ^= dum
%- (hard ,[ank=* let=@ud hit=(map ,@ud tako) lab=(map ,@tas ,@ud)])
q.q.r.u.rot
?: =(0 let.dum)
(error:he %no-ali-desk ~)
=+ (~(get by hit.dum) let.dum)
?~ -
(error:he %no-ali-version ~)
=+ (~(get by hut.ran) u.-)
?~ -
(error:he %no-ali-commit ~)
=. ali.dat u.-
|-
?- gem.dat
%init
?. =(let.dom 0)
(error:he %bad-init-merge ~)
2015-03-12 03:37:37 +03:00
:: skim hook/hoon files/
2015-02-27 09:35:41 +03:00
=. new.dat ali.dat
=. hut.ran (~(put by hut.ran) r.new.dat new.dat)
=. erg.dat (~(run by q.ali.dat) |=(lobe %&))
checkout
::
%fine
?: =(r.ali.dat r.bob.dat)
2015-04-14 00:29:39 +03:00
~& [%fine-trivial ali=<ali> bob=<bob> r.ali.dat r.bob.dat]
2015-02-27 09:35:41 +03:00
(done:he ~)
?: (~(has in (reachable-takos r.bob.dat)) r.ali.dat)
2015-04-14 00:29:39 +03:00
~& [%fine-mostly-trivial ali=<ali> bob=<bob>]
2015-02-27 09:35:41 +03:00
(done:he ~)
?. (~(has in (reachable-takos r.ali.dat)) r.bob.dat)
2015-04-14 00:29:39 +03:00
~& [%fine-not-so-trivial ali=<ali> bob=<bob>]
2015-02-27 09:35:41 +03:00
(error:he %bad-fine-merge ~)
2015-04-14 00:29:39 +03:00
~& [%fine-lets-go ali=<ali> bob=<bob>]
2015-02-27 09:35:41 +03:00
=. new.dat ali.dat
=. erg.dat
2015-03-25 00:46:32 +03:00
%- mo ^- (list ,[path ?])
%+ murn (~(tap by (~(uni by q.bob.dat) q.ali.dat)))
|= [pax=path lob=lobe]
^- (unit ,[path ?])
=+ a=(~(get by q.ali.dat) pax)
=+ b=(~(get by q.bob.dat) pax)
?: =(a b)
~
`[pax !=(~ a)]
2015-02-27 09:35:41 +03:00
checkout
::
%this
?: =(r.ali.dat r.bob.dat)
(done:he ~)
?: (~(has in (reachable-takos r.bob.dat)) r.ali.dat)
(done:he ~)
=. new.dat (make-yaki [r.ali.dat r.bob.dat ~] q.bob.dat now)
=. hut.ran (~(put by hut.ran) r.new.dat new.dat)
=. erg.dat ~
checkout
::
%that
?: =(r.ali.dat r.bob.dat)
(done:he ~)
?: (~(has in (reachable-takos r.bob.dat)) r.ali.dat)
(done:he ~)
=. new.dat (make-yaki [r.ali.dat r.bob.dat ~] q.ali.dat now)
=. hut.ran (~(put by hut.ran) r.new.dat new.dat)
=. erg.dat
2015-03-25 00:46:32 +03:00
%- mo ^- (list ,[path ?])
%+ murn (~(tap by (~(uni by q.bob.dat) q.ali.dat)))
|= [pax=path lob=lobe]
^- (unit ,[path ?])
=+ a=(~(get by q.ali.dat) pax)
=+ b=(~(get by q.bob.dat) pax)
?: =(a b)
~
`[pax !=(~ a)]
2015-02-27 09:35:41 +03:00
checkout
::
?(%meet %mate %meld)
?: =(r.ali.dat r.bob.dat)
(done:he ~)
?: (~(has in (reachable-takos r.bob.dat)) r.ali.dat)
(done:he ~)
?: (~(has in (reachable-takos r.ali.dat)) r.bob.dat)
$(gem.dat %fine)
=+ r=(find-merge-points:he ali.dat bob.dat)
?~ r
(error:he %merge-no-merge-base ~)
?. ?=([* ~ ~] r)
=+ (lent (~(tap in `(set yaki)`r)))
(error:he %merge-criss-cross >[-]< ~)
=. bas.dat n.r
2015-04-20 23:42:18 +03:00
?: ?=(?(%mate %meld) gem.dat)
2015-04-18 10:31:58 +03:00
diff-ali
=. new.dal.dat
%- mo
%+ skip (~(tap by q.ali.dat))
|= [pax=path lob=lobe]
(~(has by q.bas.dat) pax)
=. cal.dal.dat
%- mo
2015-04-20 23:42:18 +03:00
%+ skip (~(tap by q.ali.dat))
2015-04-18 10:31:58 +03:00
|= [pax=path lob=lobe]
=+ (~(get by q.bas.dat) pax)
|(=(~ -) =([~ lob] -))
=. can.dal.dat
~
=. old.dal.dat
%- mo ^- (list ,[path ~])
%+ murn (~(tap by q.bas.dat))
|= [pax=path lob=lobe]
^- (unit (pair path ,~))
?. =(~ (~(get by q.ali.dat) pax))
~
`[pax ~]
=. new.dob.dat
%- mo
%+ skip (~(tap by q.bob.dat))
|= [pax=path lob=lobe]
(~(has by q.bas.dat) pax)
=. cal.dob.dat
%- mo
%+ skip (~(tap by q.bob.dat))
|= [pax=path lob=lobe]
=+ (~(get by q.bas.dat) pax)
|(=(~ -) =([~ lob] -))
=. can.dob.dat
~
=. old.dob.dat
%- mo ^- (list ,[path ~])
%+ murn (~(tap by q.bas.dat))
|= [pax=path lob=lobe]
^- (unit (pair path ,~))
?. =(~ (~(get by q.bob.dat) pax))
~
`[pax ~]
=+ ^= bof
%- %~ int by
2015-04-21 23:23:50 +03:00
%- ~(uni by `(map path ,*)`new.dal.dat)
%- ~(uni by `(map path ,*)`cal.dal.dat)
%- ~(uni by `(map path ,*)`can.dal.dat)
2015-04-18 10:31:58 +03:00
`(map path ,*)`old.dal.dat
2015-04-21 23:23:50 +03:00
%- ~(uni by `(map path ,*)`new.dob.dat)
%- ~(uni by `(map path ,*)`cal.dob.dat)
%- ~(uni by `(map path ,*)`can.dob.dat)
2015-04-18 10:31:58 +03:00
`(map path ,*)`old.dob.dat
?^ bof
(error:he %meet-conflict >(~(run by `(map path ,*)`bof) ,_~)< ~)
=+ ^- old=(map path lobe)
%+ roll (~(tap by (~(uni by old.dal.dat) old.dob.dat)))
=< .(old q.bas.dat)
|= [[pax=path ~] old=(map path lobe)]
(~(del by old) pax)
=+ ^= hat
%- ~(uni by old)
%- ~(uni by new.dal.dat)
%- ~(uni by new.dob.dat)
%- ~(uni by cal.dal.dat)
cal.dob.dat
=+ ^- del=(map path ,?)
(~(run by (~(uni by old.dal.dat) old.dob.dat)) |=(~ %|))
=. new.dat
(make-yaki [r.ali.dat r.bob.dat ~] hat now)
=. hut.ran (~(put by hut.ran) r.new.dat new.dat)
=. erg.dat %- ~(uni by del) :: XX totes wrong
`(map path ,?)`(~(run by hat) |=(lobe %&))
checkout
2014-10-28 04:50:07 +03:00
==
2015-02-27 09:35:41 +03:00
::
++ diff-bas
2015-04-20 23:42:18 +03:00
|= [nam=term yak=yaki oth=(pair ship desk) yuk=yaki]
2015-02-27 09:35:41 +03:00
^+ +>
=- %_(+>.$ tag [- tag])
2015-04-14 03:29:54 +03:00
:* hen %pass
2015-02-27 09:35:41 +03:00
=+ (cat 3 %diff- nam)
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali - ~]
2015-03-19 22:34:25 +03:00
%f %exec p.bob [p.oth q.oth cas.dat] ~ %tabl
2015-02-27 09:35:41 +03:00
^- (list (pair silk silk))
%+ murn (~(tap by q.bas.dat))
|= [pax=path lob=lobe]
^- (unit (pair silk silk))
2015-04-20 23:42:18 +03:00
=+ a=(~(get by q.yak) pax)
?~ a
~
?: =(lob u.a)
~
=+ (~(get by q.yuk) pax)
2015-02-27 09:35:41 +03:00
?~ -
~
2015-04-20 23:42:18 +03:00
?: =(u.a u.-)
2015-02-27 09:35:41 +03:00
~
:- ~
:- [%done ~ %path !>(pax)]
2015-04-20 23:42:18 +03:00
[%diff (lobe-to-silk pax lob) (lobe-to-silk pax u.a)]
2015-02-27 09:35:41 +03:00
==
::
++ diff-ali
^+ .
2015-04-20 23:42:18 +03:00
(diff-bas %ali ali.dat ali bob.dat)
2015-02-27 09:35:41 +03:00
::
++ diffed-ali
|= res=(each gage tang)
2015-02-27 09:35:41 +03:00
^+ +>
2015-03-11 00:09:53 +03:00
?: ?=(%| -.res)
2015-02-27 09:35:41 +03:00
(error:he %diff-ali-bad-made leaf/"merge diff ali failed" p.res)
=+ cay=p.res
2015-02-27 09:35:41 +03:00
?@ p.cay
(error:he %diff-ali-bad-marc >p.cay< ~)
=| can=(map path cage)
=>
|- ^+ +
?~ p.p.cay
+.$(can ~)
=+ tal=%_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?: ?=(%| -.gon.dat.tal)
tal
?. ?=(%path p.i.p.p.cay)
+.$(+>.$ (error:he %diff-ali-strange-marc-a >p.i.p.p.cay< ~))
?. ?=(@ q.i.p.p.cay)
+.$(+>.$ (error:he %diff-ali-strange-marc-b >q.i.p.p.cay< ~))
=+ coy=(slot 2 q.cay)
?@ q.coy
+.$(+>.$ (error:he %diff-ali-strange-coy ~))
%_ +.$
can
%+ ~(put by can:tal)
((hard path) -.q.coy)
[q.i.p.p.cay (slot 3 coy)]
==
2015-02-27 09:35:41 +03:00
?: ?=(%| -.gon.dat)
+>.$
=. new.dal.dat
%- mo
%+ skip (~(tap by q.ali.dat))
|= [pax=path lob=lobe]
(~(has by q.bas.dat) pax)
2015-04-20 23:42:18 +03:00
=. cal.dal.dat
%- mo
%+ skim (~(tap by q.bas.dat))
|= [pax=path lob=lobe]
=+ a=(~(get by q.ali.dat) pax)
=+ b=(~(get by q.bob.dat) pax)
?& ?=(^ a)
!=([~ lob] a)
=([~ lob] b)
==
2015-02-27 09:35:41 +03:00
=. can.dal.dat can
=. old.dal.dat
%- mo ^- (list ,[path ~])
%+ murn (~(tap by q.bas.dat))
|= [pax=path lob=lobe]
?. =(~ (~(get by q.ali.dat) pax))
~
(some pax ~)
diff-bob
2013-09-29 00:21:18 +04:00
::
2015-02-27 09:35:41 +03:00
++ diff-bob
^+ .
2015-04-20 23:42:18 +03:00
(diff-bas %bob bob.dat bob ali.dat)
2015-02-27 09:35:41 +03:00
::
++ diffed-bob
|= res=(each gage tang)
2015-02-27 09:35:41 +03:00
^+ +>
2015-03-11 00:09:53 +03:00
?: ?=(%| -.res)
2015-02-27 09:35:41 +03:00
(error:he %diff-bob-bad-made leaf/"merge diff bob failed" p.res)
=+ cay=p.res
2015-02-27 09:35:41 +03:00
?@ p.cay
(error:he %diff-bob-bad-marc >p.cay< ~)
=| can=(map path cage)
=>
|- ^+ +
?~ p.p.cay
+.$(can ~)
=+ tal=%_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?: ?=(%| -.gon.dat.tal)
tal
?. ?=(%path p.i.p.p.cay)
+.$(+>.$ (error:he %diff-bob-strange-marc-a >p.i.p.p.cay< ~))
?. ?=(@ q.i.p.p.cay)
+.$(+>.$ (error:he %diff-bob-strange-marc-b >q.i.p.p.cay< ~))
=+ coy=(slot 2 q.cay)
?@ q.coy
+.$(+>.$ (error:he %diff-bob-strange-coy ~))
%_ +.$
can
%+ ~(put by can:tal)
((hard path) -.q.coy)
[q.i.p.p.cay (slot 3 coy)]
==
?: ?=(%| -.gon.dat)
+>.$
=. new.dob.dat
%- mo
%+ skip (~(tap by q.bob.dat))
|= [pax=path lob=lobe]
(~(has by q.bas.dat) pax)
2015-04-20 23:42:18 +03:00
=. cal.dob.dat
%- mo
%+ skim (~(tap by q.bas.dat))
|= [pax=path lob=lobe]
=+ a=(~(get by q.ali.dat) pax)
=+ b=(~(get by q.bob.dat) pax)
?& ?=(^ b)
!=([~ lob] b)
=([~ lob] a)
==
2015-02-27 09:35:41 +03:00
=. can.dob.dat can
=. old.dob.dat
%- mo ^- (list ,[path ~])
%+ murn (~(tap by q.bas.dat))
|= [pax=path lob=lobe]
?. =(~ (~(get by q.bob.dat) pax))
~
(some pax ~)
merge
::
++ merge
^+ .
|- ^+ +.$
2015-04-20 23:42:18 +03:00
?+ gem.dat ~| [%merge-weird-gem gem.dat] !!
2015-02-27 09:35:41 +03:00
?(%mate %meld)
=- %_(+.$ tag [- tag])
2015-04-14 03:29:54 +03:00
:* hen %pass
2015-02-27 09:35:41 +03:00
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %merge ~]
2015-03-19 22:34:25 +03:00
%f %exec p.bob [p.bob q.bob cas.dat] ~ %tabl
2015-02-27 09:35:41 +03:00
^- (list (pair silk silk))
%+ turn (~(tap by (~(int by can.dal.dat) can.dob.dat)))
|= [pax=path *]
^- (pair silk silk)
=+ cal=(~(got by can.dal.dat) pax)
=+ cob=(~(got by can.dob.dat) pax)
=+ ^= for
=+ (slag (dec (lent pax)) pax)
?~(- %$ i.-)
:- [%done ~ %path !>(pax)]
[%join for [%done ~ cal] [%done ~ cob]]
2013-09-29 00:21:18 +04:00
==
==
2015-02-27 09:35:41 +03:00
::
++ merged
|= res=(each gage tang)
2015-03-11 00:09:53 +03:00
?: ?=(%| -.res)
2015-02-27 09:35:41 +03:00
(error:he %merge-bad-made leaf/"merging failed" p.res)
=+ cay=p.res
2015-02-27 09:35:41 +03:00
?@ p.cay
(error:he %merge-bad-marc >p.cay< ~)
=| bof=(map path (unit cage))
=>
|- ^+ +
?~ p.p.cay
+.$(bof ~)
=+ tal=%_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?: ?=(%| -.gon.dat.tal)
tal
?. ?=(%path p.i.p.p.cay)
+.$(+>.$ (error:he %merge-strange-marc-a >p.i.p.p.cay< ~))
?. ?=(@ q.i.p.p.cay)
+.$(+>.$ (error:he %merge-strange-marc-b >q.i.p.p.cay< ~))
=+ coy=(slot 2 q.cay)
?@ q.coy
+.$(+>.$ (error:he %merge-strange-coy ~))
%_ +.$
bof
%+ ~(put by bof:tal)
((hard path) -.q.coy)
?: ?=(%null q.i.p.p.cay)
~
`[q.i.p.p.cay (slot 3 coy)]
==
?: ?=(%| -.gon.dat)
+>.$
2015-04-21 02:36:19 +03:00
=. bof.dat bof
build
::
++ build
^+ .
=- %_(+ tag [- tag])
:* hen %pass
2015-04-21 23:23:50 +03:00
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %build ~]
2015-04-21 02:36:19 +03:00
%f %exec p.bob [p.bob q.bob cas.dat] ~ %tabl
^- (list (pair silk silk))
2015-04-21 23:23:50 +03:00
%+ murn (~(tap by bof.dat))
|= [pax=path cay=(unit cage)]
^- (unit (pair silk silk))
?~ cay
~
:- ~
:- [%done ~ %path !>(pax)]
2015-04-21 02:36:19 +03:00
=+ (~(get by q.bas.dat) pax)
?~ -
~| %mate-strange-diff-no-base
!!
2015-04-21 23:23:50 +03:00
[%pact (lobe-to-silk pax u.-) [%done ~ u.cay]]
2015-04-21 02:36:19 +03:00
==
::
++ built
|= res=(each gage tang)
2015-04-21 02:36:19 +03:00
^+ +>
?: ?=(%| -.res)
(error:he %build-bad-made leaf/"delta building failed" p.res)
=+ cay=p.res
2015-04-21 02:36:19 +03:00
?@ p.cay
(error:he %build-bad-marc >p.cay< ~)
2015-04-21 23:23:50 +03:00
=| bop=(map path cage)
2015-04-21 02:36:19 +03:00
=>
|- ^+ +
?~ p.p.cay
2015-04-21 23:23:50 +03:00
+.$(bop ~)
2015-04-21 02:36:19 +03:00
=+ tal=%_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?: ?=(%| -.gon.dat.tal)
tal
?. ?=(%path p.i.p.p.cay)
+.$(+>.$ (error:he %build-strange-marc-a >p.i.p.p.cay< ~))
?. ?=(@ q.i.p.p.cay)
+.$(+>.$ (error:he %build-strange-marc-b >q.i.p.p.cay< ~))
=+ coy=(slot 2 q.cay)
?@ q.coy
+.$(+>.$ (error:he %build-strange-coy ~))
%_ +.$
2015-04-21 23:23:50 +03:00
bop
%+ ~(put by bop:tal)
2015-04-21 02:36:19 +03:00
((hard path) -.q.coy)
2015-04-21 23:23:50 +03:00
[q.i.p.p.cay (slot 3 coy)]
2015-04-21 02:36:19 +03:00
==
?: ?=(%| -.gon.dat)
+>.$
2015-04-21 23:23:50 +03:00
=. bop.dat bop
2015-02-27 09:35:41 +03:00
=+ ^- con=(map path ,*) :: 2-change conflict
%- mo
2015-04-21 23:23:50 +03:00
%+ skim (~(tap by bof.dat))
2015-02-27 09:35:41 +03:00
|=([pax=path cay=(unit cage)] ?=(~ cay))
=+ ^- cas=(map path lobe) :: conflict base
%- ~(urn by con)
2015-03-11 00:09:53 +03:00
|= [pax=path *]
2015-02-27 09:35:41 +03:00
(~(got by q.bas.dat) pax)
=. con :: add/del conflict
%- ~(uni by con)
%- mo ^- (list ,[path *])
%+ skim (~(tap by old.dal.dat))
|= [pax=path ~]
?: (~(has by new.dob.dat) pax)
~| %strange-add-and-del
!!
(~(has by can.dob.dat) pax)
=. con :: add/del conflict
%- ~(uni by con)
%- mo ^- (list ,[path *])
%+ skim (~(tap by old.dob.dat))
|= [pax=path ~]
?: (~(has by new.dal.dat) pax)
~| %strange-del-and-add
!!
(~(has by can.dal.dat) pax)
=. con :: add/add conflict
%- ~(uni by con)
%- mo ^- (list ,[path *])
%+ skip (~(tap by (~(int by new.dal.dat) new.dob.dat)))
|= [pax=path *]
=((~(got by new.dal.dat) pax) (~(got by new.dob.dat) pax))
?: &(?=(%mate gem.dat) ?=(^ con))
=+ (turn (~(tap by `(map path ,*)`con)) |=([path *] >[+<-]<))
(error:he %mate-conflict -)
=+ ^- old=(map path lobe) :: oldies but goodies
%+ roll (~(tap by (~(uni by old.dal.dat) old.dob.dat)))
=< .(old q.bas.dat)
|= [[pax=path ~] old=(map path lobe)]
(~(del by old) pax)
=+ ^- can=(map path cage) :: content changes
%- mo
^- (list (pair path cage))
2015-04-21 23:23:50 +03:00
%+ murn (~(tap by bof.dat))
2015-02-27 09:35:41 +03:00
|= [pax=path cay=(unit cage)]
^- (unit (pair path cage))
?~ cay
~
`[pax u.cay]
=^ hat lat.ran :: new content
^- [(map path lobe) (map lobe blob)]
%+ roll (~(tap by can))
=< .(lat lat.ran)
|= [[pax=path cay=cage] hat=(map path lobe) lat=(map lobe blob)]
=+ ^= bol
=+ (~(get by q.bas.dat) pax)
?~ -
~| %mate-strange-diff-no-base
!!
2015-04-21 23:23:50 +03:00
%^ make-delta
(page-to-lobe [p q.q]:(~(got by bop.dat) pax))
[(lobe-to-mark u.-) u.-]
[p q.q]:cay
2015-02-27 09:35:41 +03:00
[(~(put by hat) pax p.bol) (~(put by lat) p.bol bol)]
=. hat :: all the content
%- ~(uni by old)
%- ~(uni by new.dal.dat)
%- ~(uni by new.dob.dat)
2015-04-20 23:42:18 +03:00
%- ~(uni by cal.dal.dat)
%- ~(uni by cal.dob.dat)
2015-02-27 09:35:41 +03:00
%- ~(uni by hat)
cas
=+ ^- del=(map path ,?)
(~(run by (~(uni by old.dal.dat) old.dob.dat)) |=(~ %|))
=. gon.dat [%& (sa (turn (~(tap by con)) |=([path *] +<-)))]
=. new.dat
(make-yaki [r.ali.dat r.bob.dat ~] hat now)
=. hut.ran (~(put by hut.ran) r.new.dat new.dat)
=. erg.dat %- ~(uni by del)
`(map path ,?)`(~(run by hat) |=(lobe %&))
checkout
::
++ checkout
^+ .
=- %_(+ tag [- tag])
2015-03-12 03:37:37 +03:00
=+ val=?:(?=(%init gem.dat) ali bob)
2015-04-14 03:29:54 +03:00
:* hen %pass
2015-02-27 09:35:41 +03:00
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %checkout ~]
2015-03-12 03:37:37 +03:00
%f %exec p.bob [p.val q.val cas.dat] ~ %tabl
2015-02-27 09:35:41 +03:00
^- (list (pair silk silk))
2015-04-21 23:23:50 +03:00
%+ murn (~(tap by q.new.dat))
|= [pax=path lob=lobe]
^- (unit (pair silk silk))
?: (~(has by bop.dat) pax)
~
`[[%done ~ %path !>(pax)] (lobe-to-silk pax lob)]
2015-02-27 09:35:41 +03:00
==
::
++ checked-out
|= res=(each gage tang)
2015-02-27 09:35:41 +03:00
^+ +>
2015-03-11 00:09:53 +03:00
?: ?=(%| -.res)
2015-02-27 09:35:41 +03:00
(error:he %checkout-bad-made leaf/"merge checkout failed" p.res)
=+ cay=p.res
2015-02-27 09:35:41 +03:00
?@ p.cay
(error:he %patch-bad-marc >p.cay< ~)
=| can=(list ,[path cage])
=>
|- ^+ +
?~ p.p.cay
+.$(can ~)
=+ tal=%_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?: ?=(%| -.gon.dat.tal)
tal
?. ?=(%path p.i.p.p.cay)
+.$(+>.$ (error:he %patch-strange-marc-a >p.i.p.p.cay< ~))
?. ?=(@ q.i.p.p.cay)
+.$(+>.$ (error:he %patch-strange-marc-b >q.i.p.p.cay< ~))
=+ coy=(slot 2 q.cay)
?@ q.coy
+.$(+>.$ (error:he %patch-strange-coy ~))
%_ +.$
can
:_ can:tal
:- ((hard path) -.q.coy)
[q.i.p.p.cay (slot 3 coy)]
==
?: ?=(%| -.gon.dat)
+>.$
=. let.dom +(let.dom)
=. hit.dom (~(put by hit.dom) let.dom r.new.dat)
2015-04-21 23:23:50 +03:00
=. ank.dat (checkout-ankh:ze (~(uni by bop.dat) (mo can)))
2015-02-27 09:35:41 +03:00
=. ank.dom ank.dat
?~ hez
(done:he ~)
ergo
::
++ ergo
^+ .
=- %_(+ tag [- tag])
=+ zez=ze(ank.dom ank.dat)
2015-03-12 03:37:37 +03:00
=+ val=?:(?=(%init gem.dat) ali bob)
2015-04-14 03:29:54 +03:00
:* hen %pass
2015-02-27 09:35:41 +03:00
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %ergo ~]
%f %exec p.bob [p.val q.val cas.dat] ~ %tabl
2015-02-27 09:35:41 +03:00
^- (list (pair silk silk))
%+ turn (~(tap by erg.dat))
|= [a=path b=?]
^- (pair silk silk)
:- [%done ~ %path !>(a)]
?. b
[%done ~ %null !>(~)]
2015-03-31 01:12:18 +03:00
:+ %cast %mime
(lobe-to-silk:zez a (~(got by q.new.dat) a))
2015-02-27 09:35:41 +03:00
==
::
++ ergoed
|= res=(each gage tang)
2015-02-27 09:35:41 +03:00
^+ +>
?: ?=(%| -.res)
(error:he %ergo-bad-made leaf/"merge ergo failed" p.res)
=+ cay=p.res
2015-02-27 09:35:41 +03:00
?@ p.cay ~| %patch-bad-marc !!
=| can=(list ,[path (unit mime)])
=>
|- ^+ +
?~ p.p.cay
+.$(can ~)
=+ tal=%_($ cay [[%tabl t.p.p.cay] (slot 3 q.cay)])
?: ?=(%| -.gon.dat.tal)
tal
?. ?=(%path p.i.p.p.cay)
+.$(+>.$ (error:he %patch-strange-marc-a >p.i.p.p.cay< ~))
?. ?=(@ q.i.p.p.cay)
+.$(+>.$ (error:he %patch-strange-marc-b >p.i.p.p.cay< ~))
=+ coy=(slot 2 q.cay)
?@ q.coy
+.$(+>.$ (error:he %patch-strange-coy ~))
%_ +.$
can
:_ can:tal
:- ((hard path) -.q.coy)
?. ?=(%mime q.i.p.p.cay)
~
`((hard mime) q:(slot 3 coy))
==
?~ hez
(error:he %ergo-no-hez ~)
?: ?=(%| -.gon.dat)
+>.$
%= +>.$
don %|
reg [[u.hez %ergo who syd let.dom can] reg]
==
::
++ he
|%
++ done
|= con=(set path)
^+ ..he
..he(don |, gon.dat [%& con])
++ error
|= [err=term tan=(list tank)]
^+ ..he
..he(don |, gon.dat [%| err >ali< >bob< tan])
::
++ find-merge-points
|= [p=yaki q=yaki] :: maybe need jet
^- (set yaki)
%- reduce-merge-points
=+ r=(reachable-takos r.p)
|- ^- (set yaki)
?: (~(has in r) r.q) (~(put in *(set yaki)) q)
%+ roll p.q
|= [t=tako s=(set yaki)]
?: (~(has in r) t)
(~(put in s) (tako-to-yaki t)) :: found
(~(uni in s) ^$(q (tako-to-yaki t))) :: traverse
::
++ reduce-merge-points
|= unk=(set yaki) :: maybe need jet
=| gud=(set yaki)
=+ ^= zar
^- (map tako (set tako))
%+ roll (~(tap in unk))
|= [yak=yaki qar=(map tako (set tako))]
(~(put by qar) r.yak (reachable-takos r.yak))
|-
^- (set yaki)
?~ unk gud
=+ bun=(~(del in `(set yaki)`unk) n.unk)
?: %+ levy (~(tap by (~(uni in gud) bun)) ~)
|= yak=yaki
!(~(has in (~(got by zar) r.yak)) r.n.unk)
:: I'm pretty sure this is just wrong, but given
:: the relative intelligence levels of me and Jared,
:: I'm going to keep it here for a little bit
:: ?: %+ roll (~(tap by (~(uni in gud) bun)) ~)
:: |= [tak=yaki god=?] :: only good + unknown
:: ^- ?
:: ?. god god
:: (~(has in (~(got by zar) r.tak)) n.unk)
:: Also, I'd be curious how often this actually
:: elminates merge points
$(gud (~(put in gud) n.unk), unk bun)
$(unk bun)
--
--
2014-05-30 06:12:02 +04:00
--
2015-02-27 09:35:41 +03:00
--
::
++ do
|= [now=@da hen=duct [who=ship him=ship] syd=@tas ruf=raft]
=+ ^= rug ^- rung
=+ rug=(~(get by hoy.ruf) him)
?^(rug u.rug *rung)
=+ ^= red ^- rede
=+ yit=(~(get by rus.rug) syd)
?^(yit u.yit `rede`[~2000.1.1 ~ [~ *rind] *dome ~ ~])
((de now hen ~ ~) [who him] syd red ran.ruf)
::
++ posh
|= [him=ship syd=desk red=rede ruf=raft]
^- raft
=+ ^= rug ^- rung
=+ rug=(~(get by hoy.ruf) him)
?^(rug u.rug *rung)
ruf(hoy (~(put by hoy.ruf) him rug(rus (~(put by rus.rug) syd red))))
::
++ un :: domestic ship
|= [who=@p now=@da hen=duct ruf=raft]
=+ ^= yar ^- room
=+ yar=(~(get by fat.ruf) who)
?~(yar *room u.yar)
|%
++ abet ruf(fat (~(put by fat.ruf) who yar))
++ pish
|= [syd=@ta red=rede run=rang]
%_ +>
ran.ruf run
dos.yar
(~(put by dos.yar) syd [qyx.red dom.red dok.red mer.red])
==
2014-05-30 06:26:35 +04:00
::
2015-02-27 09:35:41 +03:00
++ wake
=+ saz=(turn (~(tap by dos.yar) ~) |=([a=@tas b=*] a))
=| moz=(list move)
=< [moz ..wake]
|- ^+ +
?~ saz +
=+ sog=abet:wake:(di i.saz)
$(saz t.saz, moz (weld moz -.sog), ..wake (pish i.saz +.sog ran.ruf))
::
++ di
|= syd=@ta
=+ ^= saq ^- dojo
=+ saq=(~(get by dos.yar) syd)
?~(saq *dojo u.saq)
%^ (de now hen hun.yar hez.yar)
[who who]
syd
[[now qyx.saq ~ dom.saq dok.saq mer.saq] ran.ruf]
2013-09-29 00:21:18 +04:00
--
2015-02-27 09:35:41 +03:00
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 4cA, filesystem vane ::
:: ::
=| :: instrument state
$: %0 :: vane version
ruf=raft :: revision tree
== ::
|= [now=@da eny=@ ski=sled] :: activate
^? :: opaque core
|% ::
++ call :: handle request
|= $: hen=duct
hic=(hypo (hobo kiss))
==
=> %= . :: XX temporary
q.hic
^- kiss
?: ?=(%soft -.q.hic)
=+
~|([%bad-soft (,@t -.p.q.hic)] ((soft kiss) p.q.hic))
?~ -
~& [%bad-softing (,@t -.p.q.hic)] !!
u.-
?: (~(nest ut -:!>(*kiss)) | p.hic) q.hic
~& [%clay-call-flub (,@tas `*`-.q.hic)]
((hard kiss) q.hic)
==
^- [p=(list move) q=_..^$]
?- -.q.hic
%font
?: (~(has by sor.ruf) +.q.hic) `..^$
2015-03-23 23:40:33 +03:00
:_ ..^$(sor.ruf (~(put by sor.ruf) +.q.hic [0 hen]))
2015-02-27 09:35:41 +03:00
:: XX pass %merg and handle response
2015-03-05 03:36:29 +03:00
:~ ^- move
:* hen %pass
2015-03-11 22:43:44 +03:00
/auto/(scot %p p.q.hic)/[q.q.hic]/(scot %p r.q.hic)/[s.q.hic]
2015-03-05 03:36:29 +03:00
%c %merg [p q r s %init]:q.hic
2014-06-06 03:00:19 +04:00
==
2015-02-27 09:35:41 +03:00
==
::
%init
:_ ..^$(fat.ruf (~(put by fat.ruf) p.q.hic [hen ~ ~]))
=+ bos=(sein p.q.hic)
~& [%bos bos p.q.hic]
?: =(bos p.q.hic) ~
^- (list move)
2015-03-12 03:37:37 +03:00
%+ turn (limo ~[%main])
2015-02-27 09:35:41 +03:00
|= syd=@tas
[hen %pass / %c %font p.q.hic syd bos syd]
::
%info
?: =(%$ q.q.hic)
[~ ..^$]
=^ mos ruf
=+ une=(un p.q.hic now hen ruf)
=+ ^= zat
(exec:(di:wake:une q.q.hic) now r.q.hic)
=+ zot=abet.zat
:- -.zot
=. une (pish:une q.q.hic +.zot ran.zat)
abet:une
[mos ..^$]
::
%into
=+ yar=(~(got by fat.ruf) p.q.hic)
:_ ..^$(fat.ruf (~(put by fat.ruf) p.q.hic yar(hez [~ hen])))
^- (list move)
?: =(%$ q.q.hic)
~
=+ dos=(~(get by dos.yar) q.q.hic)
?: &(?=(^ dos) !=(0 +>-.+<.+.dos)) :: ank.s.u.dos
?: =(ank.dom.u.dos q.q.hic)
~
:_ ~
:* hen %slip %c %info p.q.hic q.q.hic %&
(khan-to-soba `ank.dom.u.dos `r.q.hic)
2014-10-28 04:50:07 +03:00
==
2015-02-27 09:35:41 +03:00
=+ cos=(khan-to-soba ~ `r.q.hic)
=+ ^- [one=(list ,[path miso]) two=(list ,[path miso])]
%+ skid q.cos
|= [a=path b=miso]
?& ?=(%ins -.b)
?=(%mime p.p.b)
=+ (slag (dec (lent a)) a)
?| =([%hook ~] -)
=([%hoon ~] -)
== ==
:~ [hen %slip %c %info p.q.hic q.q.hic %& p.cos one]
[hen %slip %c %info p.q.hic q.q.hic %& p.cos two]
==
::
%merg :: direct state up
?: =(%$ q.q.hic)
[~ ..^$]
=^ mos ruf
=+ une=(un p.q.hic now hen ruf)
=+ ^= zat
abet:(start:(me:ze:(di:wake:une q.q.hic) r.q.hic s.q.hic) t.q.hic)
=+ zot=abet.zat
:- -.zot
=. une (pish:une q.q.hic +.zot ran.zat)
abet:une
[mos ..^$]
::
%plug
?. (~(has by sor.ruf) +.q.hic) `..^$
:_ ..^$(sor.ruf (~(del by sor.ruf) +.q.hic))
2015-03-23 23:40:33 +03:00
=+ hyn=hen:(~(got by sor.ruf) +.q.hic)
2015-02-27 09:35:41 +03:00
:~ :* hyn %pass
2015-03-23 23:40:33 +03:00
/auto/(scot %p p.q.hic)/[q.q.hic]/(scot %p r.q.hic)/[s.q.hic]
2015-02-27 09:35:41 +03:00
%c %warp [p.q.hic r.q.hic] s.q.hic ~
==
==
::
%warp
=^ mos ruf
?: =(p.p.q.hic q.p.q.hic)
=+ une=(un p.p.q.hic now hen ruf)
=+ wex=(di:une p.q.q.hic)
=+ ^= wao
?~ q.q.q.hic
ease:wex
(eave:wex u.q.q.q.hic)
=+ ^= woo
abet:wao
[-.woo abet:(pish:une p.q.q.hic +.woo ran.wao)]
=+ wex=(do now hen p.q.hic p.q.q.hic ruf)
=+ ^= woo
?~ q.q.q.hic
abet:ease:wex
abet:(eave:wex u.q.q.q.hic)
[-.woo (posh q.p.q.hic p.q.q.hic +.woo ruf)]
[mos ..^$]
::
%wart
?> ?=(%re q.q.hic)
=+ ryf=((hard riff) s.q.hic)
:_ ..^$
:~ :- hen
:^ %pass [(scot %p p.p.q.hic) (scot %p q.p.q.hic) r.q.hic]
%c
[%warp [p.p.q.hic p.p.q.hic] ryf]
==
==
::
++ doze
|= [now=@da hen=duct]
^- (unit ,@da)
~
::
++ load
|= old=[%0 ruf=raft]
^+ ..^$
..^$(ruf ruf.old)
::
++ scry :: inspect
|= [fur=(unit (set monk)) ren=@tas his=ship syd=desk lot=coin tyl=path]
^- (unit (unit cage))
=+ got=(~(has by fat.ruf) his)
=+ luk=?.(?=(%$ -.lot) ~ ((soft case) p.lot))
?~ luk [~ ~]
?: =(%$ ren)
[~ ~]
=+ run=((soft care) ren)
?~ run [~ ~]
2015-03-31 01:12:18 +03:00
=+ %. [u.run u.luk tyl]
=< aver
?: got
(di:(un his now ~ ruf) syd)
(do now ~ [his his] syd ruf)
?~ - -
?~ u.- -
?: ?=(%& -.u.u.-) ``p.u.u.-
~
2015-02-27 09:35:41 +03:00
::
++ stay [%0 ruf]
++ take :: accept response
|= [tea=wire hen=duct hin=(hypo sign)]
^- [p=(list move) q=_..^$]
?: ?=([%merge @ @ @ @ @ ~] tea)
?> ?=(?(%writ %made) +<.q.hin)
=+ our=(slav %p i.t.tea)
=* syd i.t.t.tea
=+ her=(slav %p i.t.t.t.tea)
=* sud i.t.t.t.t.tea
=* sat i.t.t.t.t.t.tea
=+ une=(un our now hen ruf)
2015-03-14 00:47:29 +03:00
=+ wak=wake:une
=+ wex=(di:wak syd)
=+ dat=?-(+<.q.hin %writ [%& p.q.hin], %made [%| q.q.hin])
2015-02-27 09:35:41 +03:00
=+ wao=abet:(route:(me:ze:wex her sud) sat dat)
=+ woo=abet:wao
2015-03-14 00:47:29 +03:00
[(weld -.wak -.woo) ..^$(ruf abet:(pish:une syd +.woo ran.wao))]
2015-03-23 23:40:33 +03:00
?: ?=([%auto @ @ @ @ ~] tea)
=+ our=(slav %p i.t.tea)
=* syd i.t.t.tea
=+ her=(slav %p i.t.t.t.tea)
=* sud i.t.t.t.t.tea
?+ +<.q.hin ~|(%weird-auto !!)
%mere
=+ nex=+(let:(~(got by sor.ruf) our syd her sud))
=. sor.ruf (~(put by sor.ruf) [our syd her sud] [nex hen])
2015-03-27 02:26:39 +03:00
=+ `move`[hen %pass tea %c %warp [our her] sud ~ %sing %y [%ud nex] /]
2015-03-23 23:40:33 +03:00
?: ?=(%& -.p.+.q.hin)
~& ['merge succeeded' p.p.+.q.hin]
[[- ~] ..^$]
~& :^ "merge failed"
"please manually merge the desks with"
2015-04-24 03:34:36 +03:00
":helm+merge %{(trip syd)} {(scow %p her)} %{(trip sud)}"
:- p.p.p.+.q.hin
2015-03-23 23:40:33 +03:00
(turn q.p.p.+.q.hin |=(tank ~(ram re +<)))
[[- ~] ..^$]
::
%writ
=+ nex=let:(~(got by sor.ruf) our syd her sud)
[[hen %pass tea %c %merg our syd her sud %mate]~ ..^$]
==
2015-03-31 01:12:18 +03:00
?: ?=([%blab care @ @ *] tea)
?> ?=(%made +<.q.hin)
?: ?=(%| -.q.q.hin)
2015-03-31 01:12:18 +03:00
~| %blab-fail
~> %mean.|.(p.q.q.hin) :: interpolate ford fail into stack trace
2015-03-31 01:12:18 +03:00
!!
?^ p.p.q.q.hin
2015-03-31 01:12:18 +03:00
~|(%bad-marc !!)
:_ ..^$ :_ ~
:* hen %give %writ ~
`[care case @tas]`[i.t.tea ((hard case) +>:(slay i.t.t.tea)) i.t.t.t.tea]
`path`t.t.t.t.tea `cage`p.q.q.hin
2015-03-31 01:12:18 +03:00
==
2015-02-27 09:35:41 +03:00
?- -.+.q.hin
%crud
[[[hen %slip %d %flog +.q.hin] ~] ..^$]
::
%made
?~ tea !!
?+ -.tea !!
2015-04-15 03:48:37 +03:00
%inserting
?> ?=([@ @ @ ~] t.tea)
2015-02-27 09:35:41 +03:00
=+ who=(slav %p i.t.tea)
=+ syd=(slav %tas i.t.t.tea)
=+ wen=(slav %da i.t.t.t.tea)
=^ mos ruf
2015-02-27 09:35:41 +03:00
=+ une=(un who now hen ruf)
2014-07-24 19:11:40 +04:00
=+ ^= zat
(take-inserting:(di:wake:une syd) wen q.q.hin)
2014-07-24 19:11:40 +04:00
=+ zot=abet.zat
2015-02-27 09:35:41 +03:00
[-.zot abet:(pish:une syd +.zot ran.zat)]
2013-09-29 00:21:18 +04:00
[mos ..^$]
::
2015-02-27 09:35:41 +03:00
%diffing
2015-04-15 03:48:37 +03:00
?> ?=([@ @ @ ~] t.tea)
=+ who=(slav %p i.t.tea)
=+ syd=(slav %tas i.t.t.tea)
=+ wen=(slav %da i.t.t.t.tea)
=^ mos ruf
=+ une=(un who now hen ruf)
=+ ^= zat
(take-diffing:(di:wake:une syd) wen q.q.hin)
2015-04-15 03:48:37 +03:00
=+ zot=abet.zat
[-.zot abet:(pish:une syd +.zot ran.zat)]
[mos ..^$]
::
%mutating
?> ?=([@ @ @ ~] t.tea)
2015-02-27 09:35:41 +03:00
=+ who=(slav %p i.t.tea)
=+ syd=(slav %tas i.t.t.tea)
=+ wen=(slav %da i.t.t.t.tea)
=^ mos ruf
2015-02-27 09:35:41 +03:00
=+ une=(un who now hen ruf)
2014-07-24 19:11:40 +04:00
=+ ^= zat
(take-mutating:(di:wake:une syd) wen q.q.hin)
2015-02-27 09:35:41 +03:00
=+ zot=abet.zat
[-.zot abet:(pish:une syd +.zot ran.zat)]
2013-09-29 00:21:18 +04:00
[mos ..^$]
2014-10-28 22:59:26 +03:00
::
2015-03-11 02:56:08 +03:00
%patching
2015-02-27 09:35:41 +03:00
?> ?=([@ @ ~] t.tea)
=+ who=(slav %p i.t.tea)
=+ syd=(slav %tas i.t.t.tea)
2014-10-28 22:59:26 +03:00
=^ mos ruf
2015-02-27 09:35:41 +03:00
?: (~(has by fat.ruf) who)
=+ une=(un who now hen ruf)
=+ zat=(take-patch:(di:wake:une syd) q.q.hin)
2015-02-27 09:35:41 +03:00
=+ zot=abet.zat
[-.zot abet:(pish:une syd +.zot ran.zat)]
=+ zax=(do now hen [who who] syd ruf)
=+ zat=(take-patch:zax q.q.hin)
2014-10-28 22:59:26 +03:00
=+ zot=abet.zat
2015-02-27 09:35:41 +03:00
[-.zot (posh who syd +.zot ruf)]
2014-10-28 22:59:26 +03:00
[mos ..^$]
::
2015-02-27 09:35:41 +03:00
%ergoing
?> ?=([@ @ ~] t.tea)
=+ who=(slav %p i.t.tea)
=+ syd=(slav %tas i.t.t.tea)
2013-09-29 00:21:18 +04:00
=^ mos ruf
2015-02-27 09:35:41 +03:00
=+ une=(un who now hen ruf)
=+ ^= zat
(take-ergo:(di:wake:une syd) q.q.hin)
2015-02-27 09:35:41 +03:00
=+ zot=abet.zat
[-.zot abet:(pish:une syd +.zot ran.zat)]
2013-09-29 00:21:18 +04:00
[mos ..^$]
2015-03-04 04:05:41 +03:00
::
%foreign-plops
?> ?=([@ @ @ ~] t.tea)
=+ our=(slav %p i.t.tea)
=+ her=(slav %p i.t.t.tea)
=* syd i.t.t.t.tea
2015-03-07 00:07:34 +03:00
=+ zax=(do now hen [our her] syd ruf)
=+ zat=(take-foreign-plops:zax q.q.hin)
2015-03-04 04:05:41 +03:00
=^ mos ruf
=+ zot=abet.zat
[-.zot (posh her syd +.zot ruf)]
2015-03-07 00:07:34 +03:00
[mos ..^$(ran.ruf ran.zat)]
2013-09-29 00:21:18 +04:00
==
::
2015-03-23 23:40:33 +03:00
%mere !!
2015-02-27 09:35:41 +03:00
%waft
?> ?=([@ @ ~] tea)
2015-03-04 04:05:41 +03:00
=+ syd=(slav %tas i.tea)
=+ inx=(slav %ud i.t.tea)
2015-02-27 09:35:41 +03:00
=+ ^= zat
=< wake
2015-03-04 04:05:41 +03:00
%- take-foreign-update:(do now hen p.+.q.hin syd ruf)
2015-03-05 03:36:29 +03:00
[inx ((hard (unit rand)) q.+.q.hin)]
2015-02-27 09:35:41 +03:00
=^ mos ruf
=+ zot=abet.zat
[-.zot (posh q.p.+.q.hin syd +.zot ruf)]
[mos ..^$(ran.ruf ran.zat)] :: merge in new obj
::
%wake
=+ dal=(turn (~(tap by fat.ruf) ~) |=([a=@p b=room] a))
=| mos=(list move)
|- ^- [p=(list move) q=_..^^$]
?~ dal [mos ..^^$]
=+ une=(un i.dal now hen ruf)
=^ som une wake:une
$(dal t.dal, ruf abet:une, mos (weld som mos))
::
%writ
?> ?=([@ @ *] tea)
2015-03-05 03:36:29 +03:00
~| i=i.tea
~| it=i.t.tea
2015-03-04 04:05:41 +03:00
=+ our=(slav %p i.tea)
=+ him=(slav %p i.t.tea)
2015-02-27 09:35:41 +03:00
:_ ..^$
2015-03-05 03:36:29 +03:00
:~ :* hen %pass ~ %a
%want [our him] [%r %re %c t.t.tea]
(bind p.+.q.hin rant-to-rand)
==
2014-06-04 14:40:09 +04:00
==
2015-02-27 09:35:41 +03:00
::
%went
?: =(%good q.+.q.hin) [~ ..^$]
~& [%clay-lost p.+.q.hin tea]
[~ ..^$]
==
2015-03-05 03:36:29 +03:00
::
++ rant-to-rand
|= rant
^- rand
[p q [p q.q]:r]
::
2015-03-10 00:36:04 +03:00
:: XX perhaps fil.khan should be (unit (unit mime)) and !>
2015-02-27 09:35:41 +03:00
++ khan-to-soba
|= [ank=(unit ankh) kan=(unit khan)]
^- soba
:- *cart
=| pax=path
|- ^- (list ,[p=path q=miso])
?~ ank
?~ kan
~
=+ =+ (~(tap by dir.u.kan))
|-(?~(+< ~ (weld ^$(pax [p.i pax], kan `q.i) $(+< t))))
?~ fil.u.kan
-
?~ u.fil.u.kan
-
[[(flop pax) %ins u.u.fil.u.kan] -]
?~ kan
=+ =+ (~(tap by r.u.ank))
|-(?~(+< ~ (weld ^$(pax [p.i pax], ank `q.i) $(+< t))))
?~ q.u.ank
-
[[(flop pax) %del q.u.q.u.ank] -]
=+ %+ weld
=+ (~(tap by r.u.ank))
|- ^- (list ,[p=path q=miso])
?~ +< ~
%- weld :_ $(+< t)
^$(pax [p.i pax], ank `q.i, kan (~(get by dir.u.kan) p.i))
=+ (~(tap by dir.u.kan))
|- ^- (list ,[p=path q=miso])
?~ +< ~
?: (~(has by r.u.ank) p.i) $(+< t)
%- weld :_ $(+< t)
^$(pax [p.i pax], kan `q.i, ank ~)
?~ q.u.ank
?~ fil.u.kan
-
?~ u.fil.u.kan
-
[[(flop pax) %ins u.u.fil.u.kan] -]
?~ fil.u.kan
-
?~ u.fil.u.kan
[[(flop pax) %del q.u.q.u.ank] -]
[[(flop pax) %mut q.u.q.u.ank u.u.fil.u.kan] -]
--