shrub/arvo/clay.hoon

2926 lines
98 KiB
Plaintext
Raw Normal View History

2015-06-12 20:56:30 +03:00
!:
2013-09-29 00:21:18 +04:00
:: clay (4c), revision control
2015-02-27 09:35:41 +03:00
::
2015-11-03 23:06:11 +03:00
:: This is split in three top-level sections: structure definitions, main
:: logic, and arvo interface.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Here are the structures. `++raft` is the formal arvo state. It's also
:: worth noting that many of the clay-related structures are defined in zuse.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
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=(unit mery) :: outstanding merge
2015-02-27 09:35:41 +03:00
== ::
2015-05-12 23:10:22 +03:00
++ gift gift-clay :: out result <-$
++ kiss kiss-clay :: in request ->$
++ mery :: merge state
$: sor=(pair ship desk) :: merge source
2015-09-05 03:15:05 +03:00
hen=duct :: formal source
gem=germ :: strategy
2015-09-05 03:15:05 +03:00
wat=wait :: waiting on
2015-02-27 09:35:41 +03:00
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
== ::
2015-09-05 03:15:05 +03:00
++ wait $? %null %ali %diff-ali %diff-bob :: what are we
%merge %build %checkout %ergo :: waiting for?
== ::
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
2015-06-23 01:03:34 +03:00
$% [%wont p=sock q=path r=*] ::
2014-06-22 02:06:42 +04:00
== == ::
$: %c :: to %clay
2015-06-04 00:18:13 +03:00
$% [%info p=@p q=@tas r=nori] :: internal edit
2015-09-08 23:15:40 +03:00
[%merg p=@p q=@tas r=@p s=@tas t=case u=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-07-10 21:49:03 +03:00
$% [%exec p=@p q=(unit ,[beak 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
2015-06-23 01:03:34 +03:00
$% [%woot p=ship q=coop] ::
2014-06-22 02:06:42 +04:00
== == ::
$: %c :: by %clay
2015-04-30 01:48:45 +03:00
$% [%note p=@tD q=tank] ::
[%mere p=(each (set path) (pair term tang))]
2015-03-05 03:36:29 +03:00
[%writ p=riot] ::
2015-02-27 09:35:41 +03:00
== == ::
$: %f ::
2015-05-26 04:17:59 +03:00
$% [%made p=@uvH q=gage] ::
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)] ::
== == == ::
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
mon=(map term beam) :: mount points
2015-06-12 06:52:42 +03:00
hez=(unit duct) :: sync duct
2014-06-11 18:06:36 +04:00
== ::
++ rede :: universal project
$: lim=@da :: complete to
ref=(unit rind) :: outgoing requests
2015-08-14 03:11:59 +03:00
qyx=cult :: subscribers
2014-06-11 18:06:36 +04:00
dom=dome :: revision state
2015-02-27 09:35:41 +03:00
dok=(unit dork) :: outstanding diffs
mer=(unit mery) :: outstanding merges
2014-06-11 18:06:36 +04:00
== ::
++ 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
dos=(map desk dojo) :: native desk
== ::
2015-03-27 02:26:39 +03:00
++ rove :: stored request
$% [%sing p=mood] :: single request
2015-05-01 23:32:04 +03:00
[%next p=mood q=(unit (each cage lobe))] :: next version
2015-03-27 02:26:39 +03:00
[%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
$: del=(list path) :: deletes
2015-04-15 03:48:37 +03:00
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
2015-06-09 23:55:07 +03:00
muc=(map path cage) :: store miso
2015-04-15 03:48:37 +03:00
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-11-03 23:06:11 +03:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 4cA, filesystem logic
::
:: This core contains the main logic of clay. Besides `++ze`, this directly
:: contains the logic for commiting new revisions (local urbits), managing
:: and notifying subscribers (reactivity), and pulling and validating content
:: (remote urbits).
::
:: The state includes:
2015-02-27 09:35:41 +03:00
::
2015-11-03 23:06:11 +03:00
:: -- current time `now`
:: -- current duct `hen`
:: -- local urbit `our`
:: -- target urbit `her`
:: -- target desk `syd`
:: -- all vane state `++raft` (rarely used, except for the object store)
2015-02-27 09:35:41 +03:00
::
2015-11-03 23:06:11 +03:00
:: For local desks, `our` == `her` is one of the urbits on our pier. For
:: foreign desks, `her` is the urbit the desk is on and `our` is the local
:: urbit that's managing the relationship with the foreign urbit. Don't mix
:: up those two, or there will be wailing and gnashing of teeth.
2015-02-27 09:35:41 +03:00
::
2015-11-03 23:06:11 +03:00
:: While setting up `++de`, we check if the given `her` is a local urbit. If
:: so, we pull the room from `fat` in the raft and get the desk information
:: from `dos` in there. Otherwise, we get the rung from `hoy` and get the
:: desk information from `rus` in there. In either case, we normalize the
:: desk information to a `++rede`, which is all the desk-specific data that
:: we utilize in `++de`. Because it's effectively a part of the `++de`
:: state, let's look at what we've got:
::
:: -- `lim` is the most recent date we're confident we have all the
:: information for. For local desks, this is always `now`. For foreign
:: desks, this is the last time we got a full update from the foreign
:: urbit.
:: -- `ref` is a possible request manager. For local desks, this is null.
:: For foreign desks, this keeps track of all pending foreign requests
:: plus a cache of the responses to previous requests.
:: -- `qyx` is the set of subscriptions, keyed by duct. These subscriptions
:: exist only until they've been filled.
:: -- `dom` is the actual state of the filetree. Since this is used almost
:: exclusively in `++ze`, we describe it there.
:: -- `dok` is a possible set of outstanding requests to ford to perform
:: various tasks on commit. This is null iff we're not in the middle of
:: a commit.
:: -- `mer` is the state of a possible pending merge. This is null iff
:: we're not in the middle of a merge. Since this is used almost
:: exclusively in `++me`, we describe it there.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2015-02-27 09:35:41 +03:00
|%
++ de :: per desk
2015-08-14 03:11:59 +03:00
|= [now=@da hen=duct raft]
|= [[our=@p her=@p] syd=desk]
=* ruf +>+<+>
=+ ^- [hun=(unit duct) rede]
=+ rom=(~(get by fat.ruf) her)
?~ rom
:- ~
%+ fall
(~(get by rus:(fall (~(get by hoy.ruf) her) *rung)) syd)
:* lim=~2000.1.1
ref=[~ *rind]
qyx=~
dom=*dome
dok=~
mer=~
==
:- `hun.u.rom
=+ jod=(fall (~(get by dos.u.rom) syd) *dojo)
:* lim=now
ref=~
qyx=qyx.jod
dom=dom.jod
dok=dok.jod
mer=mer.jod
==
=* red ->
2015-09-12 00:06:02 +03:00
=| mow=(list move)
2015-02-27 09:35:41 +03:00
|%
++ abet
2015-08-14 03:11:59 +03:00
^- [(list move) raft]
:_ =+ rom=(~(get by fat.ruf) her)
?~ rom
=+ rug=(~(put by rus:(fall (~(get by hoy.ruf) her) *rung)) syd red)
ruf(hoy (~(put by hoy.ruf) her rug))
=+ dos=(~(put by dos.u.rom) syd [qyx dom dok mer])
ruf(fat (~(put by fat.ruf) her [(need hun) dos]))
2015-09-12 00:06:02 +03:00
(flop mow)
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-04-30 04:23:46 +03:00
^- (unit (unit (each cage lobe)))
2015-02-27 09:35:41 +03:00
=+ 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
::
++ ford-fail |=(tan=tang ~|(%ford-fail (mean tan)))
2015-05-26 04:17:59 +03:00
++ unwrap-tang
|* res=(each ,* tang)
?:(?=(%& -.res) p.res (mean p.res))
2015-05-26 04:17:59 +03:00
::
++ gage-to-cages
|= gag=gage ^- (list (pair cage cage))
(unwrap-tang (gage-to-tage gag))
::
++ gage-to-success-cages
|= gag=gage
^- (list (pair cage cage))
?. ?=(%tabl -.gag)
(ford-fail ?-(-.gag %| p.gag, %& [>%strange-gage p.p.gag<]~))
%+ murn p.gag
|= [key=gage val=gage] ^- (unit ,[cage cage])
?. ?=(%& -.key)
(ford-fail ?-(-.key %| p.key, %tabl [>%strange-gage<]~))
?- -.val
%tabl (ford-fail >%strange-gage< ~)
%& (some [p.key p.val])
%| =. p.val [(sell q.p.key) p.val]
2015-08-14 03:11:59 +03:00
~> %slog.[0 %*(. >%ford-fail syd %her %why< |2.+> p.val)]
~
==
::
2015-05-26 04:17:59 +03:00
++ gage-to-tage
|= gag=gage
^- (each (list (pair cage cage)) tang)
?: ?=(%| -.gag) (mule |.(`~`(ford-fail p.gag)))
2015-05-26 04:17:59 +03:00
?. ?=(%tabl -.gag)
(mule |.(`~`(ford-fail >%strange-gage p.p.gag< ~)))
2015-05-26 04:17:59 +03:00
=< ?+(. [%& .] [@ *] .)
|- ^- ?((list ,[cage cage]) (each ,~ tang))
?~ p.gag ~
=* hed i.p.gag
?- -.p.hed
%tabl (mule |.(`~`(ford-fail >%strange-gage< ~)))
%| (mule |.(`~`(ford-fail p.p.hed)))
%& ?- -.q.hed
%tabl (mule |.(`~`(ford-fail >%strange-gage< ~)))
%| (mule |.(`~`(ford-fail p.q.hed)))
%& =+ $(p.gag t.p.gag)
?+(- [[p.p p.q]:hed -] [@ *] -)
== ==
2015-03-11 00:09:53 +03:00
::
2015-05-26 23:20:44 +03:00
++ cages-to-map
|= tay=(list (pair cage cage))
=| can=(map path cage)
|- ^- (each (map path cage) tang)
?~ tay [%& can]
=* pax p.i.tay
?. ?=(%path p.pax)
(mule |.(`~`~|([%expected-path got=p.pax] !!)))
$(tay t.tay, can (~(put by can) ((hard path) q.q.pax) q.i.tay))
2015-06-12 21:24:14 +03:00
::
2015-09-12 00:06:02 +03:00
++ emit
|= mof=move
%_(+> mow [mof mow])
::
++ emil
|= mof=(list move)
%_(+> mow (welp mof mow))
::
2015-04-28 03:46:55 +03:00
++ balk :: read and send
2015-04-30 04:23:46 +03:00
|= [hen=duct cay=(unit (each cage lobe)) 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-09-12 00:06:02 +03:00
(emit hen %pass /tyme %t %wait tym)
2015-02-27 09:35:41 +03:00
::
++ best
|= [hen=duct tym=@da]
2015-09-12 00:06:02 +03:00
(emit hen %pass /tyme %t %rest tym)
2015-02-27 09:35:41 +03:00
::
2015-04-28 03:46:55 +03:00
++ blab :: ship result
2015-04-30 04:23:46 +03:00
|= [hen=duct mun=mood dat=(each cage lobe)]
2015-02-27 09:35:41 +03:00
^+ +>
2015-03-31 01:12:18 +03:00
?: ?=(%& -.dat)
2015-09-12 00:06:02 +03:00
(emit hen %give %writ ~ [p.mun q.mun syd] r.mun p.dat)
%- emit
2015-04-14 03:29:54 +03:00
:* hen %pass [%blab p.mun (scot q.mun) syd r.mun]
2015-09-11 00:49:22 +03:00
%f %exec our ~ [her syd q.mun] (lobe-to-silk:ze r.mun p.dat)
2015-03-31 01:12:18 +03:00
==
2015-02-27 09:35:41 +03:00
::
2015-04-28 03:46:55 +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
::
2015-04-28 03:46:55 +03:00
++ blub :: ship stop
2015-02-27 09:35:41 +03:00
|= hen=duct
2015-09-12 00:06:02 +03:00
(emit hen %give %writ ~)
::
++ print-to-dill
|= [car=@tD tan=tank]
(emit (need hun) %give %note car tan)
::
++ send-over-ames
|= [a=duct b=path c=ship d=[p=@ud q=riff]]
(emit a %pass b %a %wont [our c] [%c %question p.q.d (scot %ud p.d) ~] q.d)
2015-02-27 09:35:41 +03:00
::
2015-04-28 03:46:55 +03:00
++ duce :: produce request
2015-02-27 09:35:41 +03:00
|= rov=rove
^+ +>
=. qyx (~(put by qyx) hen rov)
?~ ref
(mabe rov (cury bait hen))
2015-11-03 23:06:11 +03:00
|- ^+ +>+.$
2015-02-27 09:35:41 +03:00
=+ 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-09-12 00:06:02 +03:00
=. +>+.$
=< ?>(?=(^ ref) .)
(send-over-ames hen [(scot %ud inx) ~] her inx syd ~ vaw)
2015-02-27 09:35:41 +03:00
%= +>+.$
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)
==
::
2015-06-12 06:52:42 +03:00
++ must-ergo
|= can=(list path)
^- (map term (pair ,@ud (set path)))
%- mo ^- (list (trel term ,@ud (set path)))
%+ murn (~(tap by mon))
|= [nam=term bem=beam]
^- (unit (trel term ,@ud (set path)))
=- ?~(- ~ `[nam (lent s.bem) (sa -)])
%+ skim can
|= pax=path
2015-08-14 03:11:59 +03:00
&(=(p.bem her) =(q.bem syd) =((flop s.bem) (scag (lent s.bem) pax)))
2015-06-12 06:52:42 +03:00
::
++ mont
|= [pot=term pax=path]
^+ +>
2015-06-12 06:52:42 +03:00
=+ can=(turn (~(tap by q:(aeon-to-yaki:ze let.dom))) head)
=+ mus=(skim can |=(paf=path =(pax (scag (lent pax) paf))))
?~ mus
+>.$
2015-09-12 00:06:02 +03:00
%- emit
:* hen %pass [%ergoing (scot %p her) syd ~] %f
%exec our ~ [her syd %da now] %tabl
^- (list (pair silk silk))
%+ turn `(list path)`mus
|= a=path
^- (pair silk silk)
:- [%$ %path !>(a)]
:+ %cast %mime
=+ (need (need (read-x:ze let.dom a)))
?: ?=(%& -<)
[%$ p.-]
(lobe-to-silk:ze a p.-)
2015-06-12 06:52:42 +03:00
==
::
2015-04-28 03:46:55 +03:00
++ ease :: release request
2015-02-27 09:35:41 +03:00
^+ .
?~ ref
2015-04-29 21:57:48 +03:00
=+ rov=(~(get by qyx) hen)
2015-04-29 22:43:14 +03:00
?~ rov + :: XX handle?
2015-02-27 09:35:41 +03:00
=. qyx (~(del by qyx) hen)
2015-04-29 21:57:48 +03:00
(mabe u.rov (cury best hen))
2015-02-27 09:35:41 +03:00
=. qyx (~(del by qyx) hen)
|- ^+ +.$
=+ nux=(~(get by fod.u.ref) hen)
?~ nux +.$
2015-09-12 00:06:02 +03:00
=. +.$
=< ?>(?=(^ ref) .)
(send-over-ames hen [(scot %ud u.nux) ~] her u.nux syd ~)
2015-02-27 09:35:41 +03:00
%= +.$
fod.u.ref (~(del by fod.u.ref) hen)
bom.u.ref (~(del by bom.u.ref) u.nux)
==
::
2015-04-28 03:46:55 +03:00
++ eave :: subscribe
2015-02-27 09:35:41 +03:00
|= rav=rave
^+ +>
?- -.rav
2015-03-27 02:26:39 +03:00
%sing
2015-02-27 09:35:41 +03:00
=+ ver=(aver p.rav)
?~ ver
(duce rav)
?~ u.ver
(blub hen)
(blab hen p.rav u.u.ver)
2015-04-30 04:23:46 +03:00
::
%next
=+ ver=(aver p.rav)
?~ ver
2015-05-01 23:32:04 +03:00
(duce [- p ~]:rav)
2015-04-30 04:23:46 +03:00
?~ u.ver
(blub hen)
=+ yon=+((need (case-to-aeon:ze q.p.rav)))
|- ^+ +>.^$
?: (gth yon let.dom)
2015-05-01 23:32:04 +03:00
(duce -.rav p.rav u.ver)
2015-04-30 04:23:46 +03:00
=+ var=(aver p.rav(q [%ud yon]))
?~ var
~& [%oh-no rave=rav aeon=yon letdom=let.dom]
+>.^$
?~ u.var
2015-08-14 03:11:59 +03:00
(blab hen p.rav %& %null [%atom %n] ~) :: only her %x
2015-04-30 04:23:46 +03:00
?: (equivalent-data:ze u.u.ver u.u.var)
$(yon +(yon))
(blab hen p.rav u.u.var)
2015-02-27 09:35:41 +03:00
::
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
=. +>.$
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
==
::
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
^+ +>
2015-09-12 00:06:02 +03:00
=+ pre=`path`~[(scot %p her) syd (scot %ud let.dom)]
?- -.lem
| (print-to-dill '=' %leaf :(weld (trip p.lem) " " (spud pre)))
& |- ^+ +>.^$
?~ p.lem +>.^$
=. +>.^$
%+ print-to-dill
?-(-.q.i.p.lem %del '-', %ins '+', %dif ':')
:+ %rose ["/" "/" ~]
%+ turn (weld pre p.i.p.lem)
|= a=cord
?: ((sane %ta) a)
[%leaf (trip a)]
[%leaf (dash:ut (trip a) '\'')]
2015-09-12 00:06:02 +03:00
$(p.lem t.p.lem)
2015-02-27 09:35:41 +03:00
==
::
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-05-01 23:32:04 +03:00
wake:(echo:(checkout-ankh u.hat) wen lem)
2015-02-27 09:35:41 +03:00
?. =(~ dok)
~& %already-applying-changes +>
2015-09-06 04:14:00 +03:00
=+ del=(skim p.lem :(corl (cury test %del) head tail))
=+ ins=(skim p.lem :(corl (cury test %ins) head tail))
=+ dif=(skim p.lem :(corl (cury test %dif) head tail))
=+ mut=(skim 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-09-12 00:06:02 +03:00
=. +>.$
%- emil
^- (list move)
:~ :* hen %pass
[%inserting (scot %p her) syd (scot %da wen) ~]
%f %exec our ~ [her syd %da wen] %tabl
^- (list (pair silk silk))
%+ turn ins
2015-04-17 03:22:39 +03:00
|= [pax=path mis=miso]
?> ?=(%ins -.mis)
2015-09-12 00:06:02 +03:00
:- [%$ %path -:!>(*path) pax]
2015-04-17 03:22:39 +03:00
=+ =>((flop pax) ?~(. %$ i))
2015-09-12 00:06:02 +03:00
[%cast - [%$ p.mis]]
==
:* hen %pass
[%diffing (scot %p her) syd (scot %da wen) ~]
%f %exec our ~ [her syd %da wen] %tabl
^- (list (pair silk silk))
2015-04-15 03:48:37 +03:00
%+ turn dif
|= [pax=path mis=miso]
2015-04-17 03:22:39 +03:00
?> ?=(%dif -.mis)
2015-09-12 00:06:02 +03:00
=+ (need (need (read-x:ze let.dom pax)))
?> ?=(%& -<)
:- [%$ %path -:!>(*path) pax]
[%pact [%$ p.-] [%$ p.mis]]
==
:* hen %pass
[%castifying (scot %p her) syd (scot %da wen) ~]
%f %exec our ~ [her syd %da wen] %tabl
^- (list (pair silk silk))
2015-04-15 03:48:37 +03:00
%+ turn mut
|= [pax=path mis=miso]
?> ?=(%mut -.mis)
2015-09-12 00:06:02 +03:00
:- [%$ %path -:!>(*path) pax]
=+ (lobe-to-mark:ze (~(got by q:(aeon-to-yaki:ze let.dom)) pax))
[%cast - [%$ p.mis]]
2015-04-15 03:48:37 +03:00
==
2015-09-12 00:06:02 +03:00
==
%_ +>.$
dok
:- ~
:* (turn del |=([pax=path mis=miso] ?>(?=(%del -.mis) pax)))
::
%+ turn ink
|= [pax=path mis=miso]
^- (pair path cage)
?> ?=(%ins -.mis)
=+ =>((flop pax) ?~(. %$ i))
[pax - [%atom %t] ((hard ,@t) +>.q.q.p.mis)]
::
~
::
(mo (turn dif |=([pax=path mis=miso] ?>(?=(%dif -.mis) [pax p.mis]))))
::
~
::
(mo (turn mut |=([pax=path mis=miso] ?>(?=(%mut -.mis) [pax p.mis]))))
::
~
::
~
::
%- mo ^- (list (pair path mime))
;: welp
^- (list (pair path mime))
%+ murn ins
2015-04-14 03:29:54 +03:00
|= [pax=path mis=miso]
2015-09-12 00:06:02 +03:00
^- (unit (pair path mime))
2015-04-14 03:29:54 +03:00
?> ?=(%ins -.mis)
2015-09-12 00:06:02 +03:00
?. ?=(%mime p.p.mis)
~
`[pax ((hard mime) q.q.p.mis)]
::
^- (list (pair path mime))
%+ murn ink
2015-04-14 03:29:54 +03:00
|= [pax=path mis=miso]
2015-09-12 00:06:02 +03:00
^- (unit (pair path mime))
?> ?=(%ins -.mis)
?> ?=(%mime p.p.mis)
`[pax ((hard mime) q.q.p.mis)]
::
^- (list (pair path mime))
%+ murn mut
2015-04-14 03:29:54 +03:00
|= [pax=path mis=miso]
2015-09-12 00:06:02 +03:00
^- (unit (pair path mime))
2015-04-14 03:29:54 +03:00
?> ?=(%mut -.mis)
2015-09-12 00:06:02 +03:00
?. ?=(%mime p.p.mis)
~
`[pax ((hard mime) q.q.p.mis)]
==
==
2015-04-14 03:29:54 +03:00
==
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
2015-09-11 01:37:19 +03:00
:- [%diffing (scot %p her) syd (scot %da wen) pax]
:^ %f %exec our :+ ~ [her syd %da wen]
2015-02-27 09:35:41 +03:00
^- silk
2015-06-09 23:55:07 +03:00
:+ %diff
(lobe-to-silk:ze pax (~(got by q:(aeon-to-yaki:ze let.dom)) pax))
=+ (slag (dec (lent pax)) pax)
=+ ?~(- %$ i.-)
[%cast - [%$ p.mis]]
2015-02-27 09:35:41 +03:00
::
%ins
2015-09-11 01:37:19 +03:00
:- [%casting (scot %p her) syd (scot %da wen) pax]
:^ %f %exec our :+ ~ [her syd %da wen]
2015-02-27 09:35:41 +03:00
^- silk
=+ (slag (dec (lent pax)) pax)
=+ ?~(- %$ i.-)
[%cast - [%$ p.mis]]
2015-02-27 09:35:41 +03:00
==
::
++ 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 [pax %del ~]))
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-09-06 04:14:00 +03:00
=+ hat=(edit:ze wen %& sim)
2015-02-27 09:35:41 +03:00
?~ dok ~& %no-changes !!
?~ -.hat
2015-09-06 04:14:00 +03:00
([echo(dok ~)]:.(+>.$ +.hat) wen %& 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
2015-05-26 04:17:59 +03:00
|= [wen=@da res=gage]
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 (gage-to-success-cages res)
2015-04-15 03:48:37 +03:00
|= [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
2015-05-26 04:17:59 +03:00
|= [wen=@da res=gage]
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-05-26 04:17:59 +03:00
%+ turn (gage-to-cages 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)]
::
2015-04-25 02:35:24 +03:00
++ take-castify
2015-05-26 04:17:59 +03:00
|= [wen=@da res=gage]
2015-04-25 02:35:24 +03:00
^+ +>
?~ dok
~& %clay-take-castifying-unexpected-made +>.$
?. =(~ muh.u.dok)
~& %clay-take-castifying-redundant-made +>.$
=+ ^- cat=(list (pair path cage))
2015-05-26 04:17:59 +03:00
%+ turn (gage-to-cages res)
2015-04-25 02:35:24 +03:00
|= [pax=cage cay=cage]
?. ?=(%path p.pax)
~|(%castify-bad-path-mark !!)
[((hard path) q.q.pax) cay]
=. muh.u.dok
%- mo
%+ turn cat
|= [pax=path cay=cage]
[pax (page-to-lobe:ze [p q.q]:cay)]
2015-09-12 00:06:02 +03:00
%- emit
2015-04-25 02:35:24 +03:00
:* hen %pass
2015-09-11 01:37:19 +03:00
[%mutating (scot %p her) syd (scot %da wen) ~]
%f %exec our ~ [her syd %da wen] %tabl
2015-04-25 02:35:24 +03:00
^- (list (pair silk silk))
%+ turn cat
|= [pax=path cay=cage]
:- [%$ %path -:!>(*path) pax]
2015-06-09 23:55:07 +03:00
=+ (lobe-to-silk:ze pax (~(got by q:(aeon-to-yaki:ze let.dom)) pax))
[%diff - [%$ cay]]
2015-04-25 02:35:24 +03:00
==
::
2015-04-15 03:48:37 +03:00
++ take-mutating
2015-05-26 04:17:59 +03:00
|= [wen=@da res=gage]
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))
2015-05-26 04:17:59 +03:00
%+ murn (gage-to-cages res)
2015-04-15 03:48:37 +03:00
|= [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
2015-05-26 04:17:59 +03:00
|= res=gage
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-09-12 00:06:02 +03:00
=. dok ~
(print-to-dill '!' %rose [" " "" ""] leaf/"clay patch failed" p.res)
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 [pax %del ~]))
2015-04-17 03:22:39 +03:00
::
^- (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]))
==
2015-09-06 04:14:00 +03:00
=^ hat +>.$ (edit:ze now %& sim) :: XX do same in ++apply-edit
2015-02-27 09:35:41 +03:00
?~ dok ~& %no-dok +>.$
=>
%= .
+>.$
2015-04-17 03:22:39 +03:00
?< ?=(~ hat) :: XX whut?
2015-09-06 04:14:00 +03:00
(echo now %& sim)
2015-02-27 09:35:41 +03:00
==
?~ dok ~& %no-dok +>.$
2015-09-03 02:20:11 +03:00
=+ ^- cat=(list (trel path lobe cage))
2015-05-26 04:17:59 +03:00
%+ turn (gage-to-cages res)
|= [pax=cage cay=cage]
2015-09-03 02:20:11 +03:00
?. ?=(%path-hash p.pax)
2015-05-26 04:17:59 +03:00
~|(%patch-bad-path-mark !!)
2015-09-03 02:20:11 +03:00
[-< -> +]:[((hard ,[path lobe]) q.q.pax) cay]
2015-04-14 00:29:39 +03:00
:: ~& %canned
:: ~& %checking-out
2015-05-26 04:17:59 +03:00
=. ank.dom (checkout-ankh:ze (mo cat))
2015-04-14 00:29:39 +03:00
:: ~& %checked-out
2015-09-03 02:20:11 +03:00
:: ~& %waking
=. +>.$ =>(wake ?>(?=(^ dok) .))
:: ~& %waked
2015-02-27 09:35:41 +03:00
?~ hez +>.$(dok ~)
2015-06-12 06:52:42 +03:00
=+ mus=(must-ergo (turn sim head))
?: =(~ mus)
+>.$(dok ~)
2015-06-13 03:48:16 +03:00
=+ ^- sum=(set path)
=+ (turn (~(tap by mus)) (corl tail tail))
%+ roll -
|= [pak=(set path) acc=(set path)]
(~(uni in acc) pak)
=+ can=(mo sim)
2015-04-14 00:29:39 +03:00
:: ~& %forming-ergo
:: =- ~& %formed-ergo -
2015-09-12 00:06:02 +03:00
%- emit(dok ~)
:* hen %pass [%ergoing (scot %p her) syd ~] %f
%exec our ~ [her syd %da now] %tabl
^- (list (pair silk silk))
%+ turn (~(tap in sum))
|= a=path
^- (pair silk silk)
:- [%$ %path !>(a)]
=+ b=(~(got by can) a)
?: ?=(%del -.b)
[%$ %null !>(~)]
=+ (~(get by mim.u.dok) a)
?^ - [%$ %mime !>(u.-)]
:+ %cast %mime
=+ (need (need (read-x:ze let.dom a)))
?: ?=(%& -<)
[%$ p.-]
(lobe-to-silk:ze a p.-)
2015-02-27 09:35:41 +03:00
==
::
++ take-ergo
2015-06-13 03:48:16 +03:00
|= res=gage
2015-02-27 09:35:41 +03:00
^+ +>
?: ?=(%| -.res)
2015-09-12 00:06:02 +03:00
(print-to-dill '!' %rose [" " "" ""] leaf/"clay ergo failed" p.res)
?~ hez ~|(%no-sync-duct !!)
2015-06-13 03:48:16 +03:00
=+ ^- can=(map path (unit mime))
%- mo ^- mode
%+ turn (gage-to-cages res)
|= [pax=cage mim=cage]
?. ?=(%path p.pax)
~|(%ergo-bad-path-mark !!)
:- ((hard path) q.q.pax)
?. ?=(%mime p.mim)
~
`((hard mime) q.q.mim)
=+ mus=(must-ergo (turn (~(tap by can)) head))
2015-09-12 00:06:02 +03:00
%- emil
%+ turn (~(tap by mus))
|= [pot=term len=@ud pak=(set path)]
:* u.hez %give %ergo pot
%+ turn (~(tap in pak))
|= pax=path
[(slag len pax) (~(got by can) pax)]
2015-06-12 06:52:42 +03:00
==
2015-02-27 09:35:41 +03:00
::
2015-03-11 02:56:08 +03:00
++ checkout-ankh
2015-02-27 09:35:41 +03:00
|= hat=(map path lobe)
^+ +>
2015-09-12 00:06:02 +03:00
%- emit
:* hen %pass [%patching (scot %p her) syd ~] %f
%exec our :^ ~ [her syd %da now] %tabl
^- (list (pair silk silk))
%+ turn (~(tap by hat))
|= [a=path b=lobe]
^- (pair silk silk)
:- [%$ %path-hash !>([a b])]
(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
2015-06-13 03:23:08 +03:00
|= $: lem=(unit ,@da) :: complete up to
gar=(map aeon tako) :: new ids
2015-03-04 04:05:41 +03:00
let=aeon :: next id
lar=(set yaki) :: new commits
bar=(set blob) :: new content
==
2015-02-27 09:35:41 +03:00
^+ +>
2015-08-14 03:11:59 +03:00
=< wake
2015-06-04 00:18:13 +03:00
=+ ^- nut=(map tako yaki)
%- mo ^- (list (pair tako yaki))
%+ turn (~(tap in lar))
|= yak=yaki
[r.yak yak]
=+ ^- nat=(map lobe blob)
%- mo ^- (list (pair lobe blob))
%+ turn (~(tap in bar))
|= bol=blob
[p.bol bol]
~| :* %bad-foreign-update
:* gar=gar
let=let
nut=(~(run by nut) ,~)
nat=(~(run by nat) ,~)
==
:* hitdom=hit.dom
letdom=let.dom
hutran=(~(run by hut.ran) ,~)
latran=(~(run by lat.ran) ,~)
==
==
=+ hit=(~(uni by hit.dom) gar)
=+ let=let
=+ hut=(~(uni by hut.ran) nut)
=+ lat=(~(uni by lat.ran) nat)
=+ ?: =(0 let) ~
=+ yon=`aeon`1 :: sanity check
2015-06-04 00:18:13 +03:00
|-
~| yon=yon
=+ tak=(~(got by hit) yon)
=+ yak=(~(got by hut) tak)
=+ %- ~(urn by q.yak)
|= [pax=path lob=lobe]
~| [pax=path lob=lobe]
(~(got by lat) lob)
?: =(let yon)
~
$(yon +(yon))
%= +>.$
2015-06-13 03:23:08 +03:00
lim (max (fall lem lim) lim)
2015-06-04 00:18:13 +03:00
hit.dom hit
2015-07-15 01:32:12 +03:00
let.dom (max let let.dom)
2015-06-04 00:18:13 +03:00
hut.ran hut
lat.ran lat
2015-02-27 09:35:41 +03:00
==
::
++ exec :: change and update
|= [wen=@da lem=nori]
^+ +>
2015-05-01 23:32:04 +03:00
(edit wen lem)
2015-02-27 09:35:41 +03:00
::
2015-09-05 03:15:05 +03:00
:: Be careful to call ++wake if/when necessary. Every case
:: must call it individually.
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
2015-09-05 03:15:05 +03:00
=< ?>(?=(^ ref) .)
%_ wake
2015-02-27 09:35:41 +03:00
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
2015-05-14 23:28:25 +03:00
=< ?>(?=(^ ref) .)
(validate-x p.p.u.rut q.p.u.rut q.u.rut r.u.rut)
2015-03-05 03:36:29 +03:00
::
%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
==
2015-09-05 03:15:05 +03:00
?. ?=(%nako p.r.u.rut) [?>(?=(^ ref) .)]:wake
2015-06-13 03:23:08 +03:00
=+ rav=`rave`q.u.ruv
?> ?=(%many -.rav)
2015-03-05 03:36:29 +03:00
|- ^+ +>+.^$
=+ 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)
2015-06-13 03:23:08 +03:00
=< ?>(?=(^ ref) .)
%+ apply-foreign-update
?.(?=(%da -.q.q.rav) ~ `p.q.q.rav)
(need nak.u.ref)
=< ?>(?=(^ ref) .)
%^ validate-plops
[%ud let.dom]
?.(?=(%da -.q.q.rav) ~ `p.q.q.rav)
bar:(need nak.u.ref)
2015-03-05 03:36:29 +03:00
%= $
haw.u.ref (~(del by haw.u.ref) nez)
==
::
%y
2015-09-05 03:15:05 +03:00
=< ?>(?=(^ ref) .)
%_ wake
2015-03-05 03:36:29 +03:00
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
2015-09-05 03:15:05 +03:00
~| %its-prolly-not-reasonable-to-request-ankh-over-the-network-sorry
2015-03-05 03:36:29 +03:00
!!
2015-02-27 09:35:41 +03:00
==
::
2015-05-14 23:28:25 +03:00
++ validate-x
|= [car=care cas=case pax=path peg=page]
^+ +>
2015-09-12 00:06:02 +03:00
%- emit
2015-05-14 23:28:25 +03:00
:* hen %pass
2015-08-14 03:11:59 +03:00
[%foreign-x (scot %p our) (scot %p her) syd car (scot cas) pax]
%f %exec our ~ [her syd cas]
2015-07-10 21:49:03 +03:00
[%vale peg]
2015-05-14 23:28:25 +03:00
==
::
++ take-foreign-x
2015-05-26 23:20:44 +03:00
|= [car=care cas=case pax=path res=gage]
2015-05-14 23:28:25 +03:00
^+ +>
?> ?=(^ ref)
2015-05-26 23:20:44 +03:00
?. ?=(%& -.res)
2015-06-01 23:46:36 +03:00
~| "validate foreign x failed"
2015-05-30 02:47:38 +03:00
=+ why=?-(-.res %| p.res, %tabl ~[>%bad-marc<])
~> %mean.|.(%*(. >[%plop-fail %why]< |1.+> why))
2015-05-14 23:28:25 +03:00
!!
?> ?=(@ p.p.res)
wake(haw.u.ref (~(put by haw.u.ref) [car cas pax] `p.res))
::
2015-03-04 04:05:41 +03:00
++ validate-plops
2015-06-13 03:23:08 +03:00
|= [cas=case lem=(unit ,@da) pop=(set plop)]
2015-03-04 04:05:41 +03:00
^+ +>
2015-06-13 03:23:08 +03:00
=+ lum=(scot %da (fall lem *@da))
2015-09-12 00:06:02 +03:00
%- emit
2015-04-14 03:29:54 +03:00
:* hen %pass
2015-08-14 03:11:59 +03:00
[%foreign-plops (scot %p our) (scot %p her) syd lum ~]
%f %exec our ~ [her syd cas] %tabl
2015-03-04 04:05:41 +03:00
^- (list (pair silk silk))
%+ turn (~(tap in pop))
|= a=plop
?- -.a
2015-09-12 00:06:02 +03:00
%delta [[%$ %blob !>([%delta p.a q.a *page])] [%vale p.r.a q.r.a]]
%direct [[%$ %blob !>([%direct p.a *page])] [%vale p.q.a q.q.a]]
2015-03-04 04:05:41 +03:00
==
==
::
++ take-foreign-plops
2015-06-13 03:23:08 +03:00
|= [lem=(unit ,@da) res=gage]
2015-03-04 04:05:41 +03:00
^+ +>
?> ?=(^ ref)
?> ?=(^ nak.u.ref)
2015-05-26 23:20:44 +03:00
=+ ^- lat=(list blob)
2015-06-01 23:46:36 +03:00
%+ turn ~|("validate foreign plops failed" (gage-to-cages res))
2015-05-26 23:20:44 +03:00
|= [bob=cage cay=cage]
?. ?=(%blob p.bob)
~| %plop-not-blob
2015-03-04 04:05:41 +03:00
!!
2015-06-01 23:46:36 +03:00
=+ bol=((hard blob) q.q.bob)
?- -.bol
2015-05-26 23:20:44 +03:00
%delta [-.bol p.bol q.bol p.cay q.q.cay]
%direct [-.bol p.bol p.cay q.q.cay]
2015-03-04 04:05:41 +03:00
==
%^ apply-foreign-update
2015-06-13 03:23:08 +03:00
lem
gar.u.nak.u.ref
:+ let.u.nak.u.ref
lar.u.nak.u.ref
(sa lat)
2015-03-04 04:05:41 +03:00
::
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-04-30 04:23:46 +03:00
::
%next ~
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-05-01 23:32:04 +03:00
?- -.rov
%sing rov
%next [- p]:rov
%many [%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
2015-04-30 04:23:46 +03:00
?~ vid
2015-06-01 23:46:36 +03:00
:: ?: =(0 u.nao)
:: ~& [%oh-poor `path`[syd '0' r.p.q.i.xiq]]
:: $(xiq t.xiq)
:: ~& [%oh-well desk=syd mood=p.q.i.xiq aeon=u.nao]
2015-04-30 04:23:46 +03:00
$(xiq t.xiq, xaq [i.xiq xaq])
$(xiq t.xiq, ..wake (balk p.i.xiq u.vid p.q.i.xiq))
2015-04-30 04:23:46 +03:00
::
%next
=* mun p.q.i.xiq
2015-05-01 23:32:04 +03:00
=* dat q.q.i.xiq
?~ dat
=+ ver=(aver mun)
?~ ver
$(xiq t.xiq, xaq [i.xiq xaq])
?~ u.ver
$(xiq t.xiq, ..wake (blub p.i.xiq))
$(xiq t.xiq, xaq [i.xiq(q.q u.ver) xaq])
2015-04-30 04:23:46 +03:00
=+ var=(aver mun(q [%ud let.dom]))
?~ var
~& [%oh-noes mood=mun letdom=let.dom]
$(xiq t.xiq)
?~ u.var
$(xiq t.xiq, ..wake (blab p.i.xiq mun %& %null [%atom %n] ~))
2015-05-01 23:32:04 +03:00
?: (equivalent-data:ze u.dat u.u.var)
2015-04-30 04:23:46 +03:00
$(xiq t.xiq, xaq [i.xiq xaq])
$(xiq t.xiq, ..wake (blab p.i.xiq mun u.u.var))
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
==
==
2015-09-16 03:24:44 +03:00
++ drop-me
^+ .
?~ mer
.
%- emit(mer ~) ^- move :*
hen.u.mer %give %mere %| %user-interrupt
>sor.u.mer< >our< >cas.u.mer< >gem.u.mer< ~
==
::
2015-11-03 23:06:11 +03:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: This core has no additional state, and the distinction exists purely for
:: documentation. The overarching theme is that `++de` directly contains
:: logic for metadata about the desk, while `++ze` is composed primarily
:: of helper functions for manipulating the desk state (`++dome`) itself.
:: Functions include:
::
:: -- converting between cases, commit hashes, commits, content hashes,
:: and conent
:: -- creating commits and content and adding them to the tree
:: -- finding which data needs to be sent over the network to keep the
:: -- other urbit up-to-date
:: -- reading from the file tree through different `++care` options
:: -- the `++me` core for merging.
::
:: The dome is composed of the following:
::
:: -- `ank` is the ankh, which is the file data itself. An ankh is both
:: a possible file and a possible directory. An ankh has both:
:: -- `fil`, a possible file, stored as both a cage and its hash
:: -- `dir`, a map of @ta to more ankhs.
:: -- `let` is the number of the most recent revision.
:: -- `hit` is a map of revision numbers to commit hashes.
:: -- `lab` is a map of labels to revision numbers.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
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
==
2015-04-30 04:23:46 +03:00
++ lobe-to-silk :: XX maybe move hoo{n,k} stuff here
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)))
?> ?=(%& -<)
[%$ p.-]
2015-03-19 00:25:01 +03:00
=+ bol=(~(got by lat.ran) lob)
?- -.bol
%direct [%volt q.bol]
%delta ~| delta/q.q.bol
[%pact $(lob q.q.bol) [%volt r.bol]]
2015-03-04 04:05:41 +03:00
==
::
2015-04-25 00:07:34 +03:00
++ page-to-lobe |=(page (shax (jam +<)))
2015-04-30 04:23:46 +03:00
++ equivalent-data
|= [one=(each cage lobe) two=(each cage lobe)]
^- ?
?: ?=(%& -.one)
?: ?=(%& -.two)
=([p q.q]:p.one [p q.q]:p.two)
=(p.two (page-to-lobe [p q.q]:p.one))
?: ?=(%& -.two)
=(p.one (page-to-lobe [p q.q]:p.two))
=(p.one p.two)
::
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-08-14 03:11:59 +03:00
=+ her==>((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
2015-06-13 03:48:16 +03:00
:: XX of course that's a problem, p.u.ber isn't in rang since it
2015-09-06 04:14:00 +03:00
:: was just created. We shouldn't be sending multiple
2015-06-13 03:48:16 +03:00
:: diffs
2015-09-06 04:14:00 +03:00
:: %+ ~(put by bar) pax
:: (make-delta p.mys [(lobe-to-mark p.u.ber) p.u.ber] [p q.q]:q.mys)
:: :: XX check vase !evil
~|([%two-diffs-for-same-file syd pax] !!)
2013-10-08 04:40:45 +04:00
==
::
2015-02-27 09:35:41 +03:00
++ 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
2015-09-03 02:20:11 +03:00
|= hat=(map path (pair lobe cage))
2015-02-27 09:35:41 +03:00
^- ankh
2015-09-03 02:20:11 +03:00
:: %- cosh
2015-02-27 09:35:41 +03:00
%+ roll (~(tap by hat) ~)
2015-09-03 02:20:11 +03:00
|= [[pat=path lob=lobe zar=cage] ank=ankh]
2015-02-27 09:35:41 +03:00
^- ankh
2015-09-03 02:20:11 +03:00
:: %- cosh
2015-02-27 09:35:41 +03:00
?~ pat
2015-09-06 04:14:00 +03:00
ank(fil [~ lob zar])
=+ nak=(~(get by dir.ank) i.pat)
2015-02-27 09:35:41 +03:00
%= ank
2015-09-06 04:14:00 +03:00
dir %+ ~(put by dir.ank) i.pat
$(pat t.pat, ank (fall nak *ankh))
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-yaki :: forge-yaki:ze
|= [wen=@da par=(unit tako) lem=suba] :: forge yaki
=+ ^= per
?~ par ~
~[u.par]
2015-09-06 04:14:00 +03:00
=+ gar=(update-lat (apply-changes 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-07-15 01:32:12 +03:00
:+ ?> (lte b let.dom)
|-
?: =(b let.dom)
hit.dom
$(hit.dom (~(del by hit.dom) let.dom), let.dom (dec let.dom))
b
?: =(0 b)
[~ ~]
2015-03-06 04:19:54 +03:00
(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
2015-04-30 04:23:46 +03:00
%u !! :: [~ %null [%atom %n] ~]
2015-02-27 09:35:41 +03:00
%v [~ %dome !>(dom)]
2015-04-30 04:23:46 +03:00
%x !! :: ?~(q.ank.dom ~ [~ q.u.q.ank.dom])
%y !! :: [~ %arch !>(as-arch)]
2015-02-27 09:35:41 +03:00
%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
2015-07-15 01:32:12 +03:00
%direct (~(put in far) lob)
%delta (~(put in $(lob q.q.gar)) lob)
2015-03-20 22:20:17 +03:00
==
::
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)
%+ roll p.y
2015-07-15 01:32:12 +03:00
=< .(s (~(put in *(set tako)) p))
2015-02-27 09:35:41 +03:00
|= [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
2015-09-06 04:14:00 +03:00
?^(r.mun ~ !!) :: [~ %w !>([t.yak (forge-nori yak)])])
2015-02-27 09:35:41 +03:00
(query(ank.dom ank:(descend-path:(zu ank.dom) r.mun)) p.mun)
::
2015-04-30 04:23:46 +03:00
++ read-u
|= [yon=aeon pax=path]
^- (unit (unit (each ,[%null (hypo ,~)] lobe)))
=+ tak=(~(get by hit.dom) yon)
?~ tak
~
```[%null [%atom %n] ~]
::
2015-09-12 00:06:02 +03:00
++ read-v
|= [yon=aeon pax=path]
^- (unit (unit ,[%dome (hypo dome)]))
?: (lth yon let.dom)
~
?: (gth yon let.dom)
`~
``[%dome -:!>(*dome) dom]
::
++ read-x
|= [yon=aeon pax=path]
2015-04-30 04:23:46 +03:00
^- (unit (unit (each cage lobe)))
2015-06-02 00:23:25 +03:00
?: =(0 yon)
[~ ~]
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-09-06 04:14:00 +03:00
:- ~
%+ bind
fil.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-04-30 04:23:46 +03:00
[~ ~ %| 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)
?> ?=(%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]
2015-04-30 04:23:46 +03:00
^- (unit (unit ,[%arch (hypo arch)]))
2015-06-02 00:23:25 +03:00
?: =(0 yon)
``[%arch -:!>(*arch) *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
:: ~& cy/pax
:- -:!>(*arch)
^- arch
=+ ^- descendants=(list (pair path lobe))
2015-06-13 03:23:08 +03:00
:: ~& %turning
:: =- ~& %turned -
%+ turn
2015-06-13 03:23:08 +03:00
:: ~& %skimming
:: =- ~& %skimmed -
%+ skim (~(tap by (~(del by q.yak) pax)))
|= [paf=path lob=lobe]
=(pax (scag len paf))
|= [paf=path lob=lobe]
[(slag len paf) lob]
=+ us=(~(get by q.yak) pax)
:+ ?: &(?=(~ descendants) ?=(~ us))
*@uvI
%+ roll
^- (list (pair path lobe))
[[~ ?~(us *lobe u.us)] descendants]
|=([[path lobe] @uvI] (shax (jam +<)))
us
^- (map span ,~)
%- mo ^- (list (pair span ,~))
%+ turn descendants
|= [paf=path lob=lobe]
[?>(?=(^ paf) i.paf) ~]
::
2015-02-27 09:35:41 +03:00
++ read-at-aeon :: read-at-aeon:ze
|= [yon=aeon mun=mood] :: seek and read
2015-04-30 04:23:46 +03:00
^- (unit (unit (each cage lobe)))
2015-08-14 03:11:59 +03:00
?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB only her speed
2015-03-31 01:12:18 +03:00
?^(r.mun [~ ~] [~ ~ %& %aeon !>(yon)])
2015-04-30 04:23:46 +03:00
?: ?=(%u p.mun)
(read-u yon r.mun)
2015-09-12 00:06:02 +03:00
?: ?=(%v p.mun)
(bind (read-v yon r.mun) (curr bind (cury same %&)))
?: ?=(%x p.mun)
(read-x yon r.mun)
?: ?=(%y p.mun)
2015-09-08 23:15:40 +03:00
:: =- ~& :* %dude-someones-getting-curious
:: mun=mun
:: yon=yon
:: our=our
:: her=her
:: syd=syd
:: hep=-
:: ==
:: -
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-04-30 04:23:46 +03:00
^- (unit (each cage lobe))
2015-06-12 21:24:14 +03:00
?~ a
2015-03-31 01:12:18 +03:00
~
2015-04-30 04:23:46 +03:00
`(unit (each cage lobe))`(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)
2015-09-17 02:45:54 +03:00
:: ?-(-.- %direct q.-, %delta !!)
2015-03-11 02:56:08 +03:00
::`+>.$(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
^+ +>
2015-09-06 04:14:00 +03:00
=+ you=(~(get by dir.ank) lol)
+>.$(ram [lol ram], ank ?~(you [~ ~] u.you))
2015-02-27 09:35:41 +03:00
::
++ descend-path :: descend recursively
|= way=path
^+ +>
?~(way +> $(way t.way, +> (descend i.way)))
--
::
2015-11-03 23:06:11 +03:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: This core is specific to any currently running merge. This is
:: basically a simple (DAG-shaped) state machine. We always say we're
:: merging from 'ali' to 'bob. The basic steps, not all of which are
:: always needed, are:
::
:: -- fetch ali's desk
:: -- diff ali's desk against the mergebase
:: -- diff bob's desk against the mergebase
:: -- merge the diffs
:: -- build the new state
:: -- "checkout" (apply to actual `++dome`) the new state
:: -- "ergo" (tell unix about) any changes
::
:: The state filled in order through each step:
::
:: -- `sor` is the urbit and desk of ali.
:: -- `hen` is the duct that instigated the merge.
:: -- `gem` is the merge strategy. These are described in
:: `++fetched-ali`.
:: -- `wat` is the current step of the merge process.
:: -- `cas` is the case in ali's desk that we're merging from.
:: -- `ali` is the commit from ali's desk.
:: -- `bob` is the commit from bob's desk.
:: -- `bas` is the commit from the mergebase.
:: -- `dal` is the set of changes from the mergebase to ali's desk.
:: -- `dob` is the set of changes from the mergebase to bob's desk.
:: These two merit slightly more explanation. There are four kinds
:: of changes:
:: -- `new` is the set of files in the new desk and not in the
:: mergebase.
:: -- `cal` is the set of changes in the new desk from the mergebase
:: except for any that are also in the other new desk.
:: -- `can` is the set of changes in the new desk from the mergebase
:: and that are also in the other new desk (potential conflicts).
:: -- `old` is the set of files in the mergebase and not in the new
:: desk.
:: -- `bof` is the set of changes to the same files in ali and bob.
:: Null for a file means a conflict while a cage means the diffs
:: have been merged.
:: -- `bop` is the result of patching the original files with the above
:: merged diffs.
:: -- `new` is the newly-created commit.
:: -- `ank` is the ankh for the new state.
:: -- `erg` is the sets of files that should be told to unix. True
:: means to write the file while false means to delete the file.
:: -- `gon` is the return value of the merge. On success we produce a
:: set of the paths that had conflicting changes. On failure we
:: produce an error code and message.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2015-02-27 09:35:41 +03:00
++ me :: merge ali into bob
|= [ali=(pair ship desk) alh=(unit ankh) new=?] :: from
2015-08-14 03:11:59 +03:00
=+ bob=`(pair ship desk)`[our syd] :: to
=+ ^- dat=(each mery term)
?~ mer
?: new
=+ *mery
2015-09-05 03:15:05 +03:00
`-(sor ali:+, hen hen:+, wat %null)
[%| %not-actually-merging]
?. new
?: =(ali sor.u.mer)
`u.mer
2015-09-05 03:15:05 +03:00
~& :* %already-merging-from-somewhere-else
ali=ali
sor=sor.u.mer
gem=gem.u.mer
wat=wat.u.mer
cas=cas.u.mer
hen=hen
henmer=hen.u.mer
==
[%| %already-merging-from-somewhere-else]
2015-09-05 03:15:05 +03:00
~& :* %already-merging-from-somewhere
ali=ali
sor=sor.u.mer
gem=gem.u.mer
wat=wat.u.mer
cas=cas.u.mer
hen=hen
henmer=hen.u.mer
==
[%| %already-merging-from-somewhere]
?: ?=(%| -.dat)
~|(p.dat !!)
=+ dat=p.dat
2015-02-27 09:35:41 +03:00
=| don=? :: keep going
|%
++ abet
^+ ..me
2015-03-19 22:34:25 +03:00
?: don
..me(mer `dat)
2015-09-12 00:06:02 +03:00
=. mer ~
2015-09-16 03:24:44 +03:00
=> (emit hen.dat %give %mere gon.dat)
2015-09-12 00:06:02 +03:00
..me
::
++ emit
|= move
%_(+> ..ze (^emit +<))
::
++ emil
|= (list move)
%_(+> ..ze (^emil +<))
2015-02-27 09:35:41 +03:00
::
++ route
2015-05-26 23:20:44 +03:00
|= [sat=term res=(each riot gage)]
2015-02-27 09:35:41 +03:00
^+ +>.$
2015-09-05 03:15:05 +03:00
?. =(sat wat.dat)
~| :* %hold-your-horses-merge-out-of-order
sat=sat
wat=wat.dat
ali=ali
bob=bob
hepres=-.res
==
!!
2015-05-26 23:20:44 +03:00
?+ +< ~|((crip <[%bad-stage sat ?~(-.res %riot %gage)]>) !!)
[%ali %& *] %.(p.res fetched-ali)
[%diff-ali %| *] %.(p.res diffed-ali)
[%diff-bob %| *] %.(p.res diffed-bob)
[%merge %| *] %.(p.res merged)
[%build %| *] %.(p.res built)
[%checkout %| *] %.(p.res checked-out)
[%ergo %| *] %.(p.res ergoed)
2014-10-28 04:50:07 +03:00
==
2015-02-27 09:35:41 +03:00
::
++ start
2015-09-08 23:15:40 +03:00
|= [cas=case gem=germ]
2015-02-27 09:35:41 +03:00
^+ +>
2015-04-30 01:48:45 +03:00
?: &(=(0 let.dom) !?=(?(%init %that) gem))
2015-02-27 09:35:41 +03:00
(error:he %no-bob-desk ~)
2015-09-08 23:15:40 +03:00
=. cas.dat cas
2015-02-27 09:35:41 +03:00
=. gem.dat gem
2015-04-28 21:20:22 +03:00
?: =(0 let.dom)
fetch-ali(gem.dat %init)
2015-02-27 09:35:41 +03:00
=+ (~(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
^+ .
2015-09-12 00:06:02 +03:00
%- emit(wat.dat %ali)
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
=. new.dat ali.dat
=. hut.ran (~(put by hut.ran) r.new.dat new.dat)
=. erg.dat (~(run by q.ali.dat) |=(lobe %&))
checkout
::
%this
?: =(r.ali.dat r.bob.dat) done:he
?: (~(has in (reachable-takos r.bob.dat)) r.ali.dat) done:he
2015-02-27 09:35:41 +03:00
=. 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
2015-02-27 09:35:41 +03:00
=. 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)
2015-09-11 03:25:27 +03:00
?: =(a b)
~
`[pax !=(~ a)]
checkout
::
%fine
?: =(r.ali.dat r.bob.dat)
:: ~& [%fine-trivial ali=<ali> bob=<bob> r.ali.dat r.bob.dat]
done:he
?: (~(has in (reachable-takos r.bob.dat)) r.ali.dat)
:: ~& [%fine-mostly-trivial ali=<ali> bob=<bob>]
done:he
?. (~(has in (reachable-takos r.ali.dat)) r.bob.dat)
:: ~& [%fine-not-so-trivial ali=<ali> bob=<bob>]
(error:he %bad-fine-merge ~)
:: ~& [%fine-lets-go ali=<ali> bob=<bob>]
=. new.dat ali.dat
=. erg.dat
%- 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)
2015-03-25 00:46:32 +03:00
?: =(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 by hut.ran) r.bob.dat)
2015-09-08 22:24:31 +03:00
(error:he %bad-bob-tako >r.bob.dat< ~)
2015-02-27 09:35:41 +03:00
?: (~(has in (reachable-takos r.bob.dat)) r.ali.dat)
done:he
2015-02-27 09:35:41 +03:00
?: (~(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)
2015-04-25 02:35:24 +03:00
=. erg.dat %- ~(uni by del)
^- (map path ,?)
%. |=(lobe %&)
~(run by (~(uni by new.dal.dat) cal.dal.dat))
2015-04-18 10:31:58 +03:00
checkout
2014-10-28 04:50:07 +03:00
==
2015-02-27 09:35:41 +03:00
::
++ diff-bas
2015-09-11 00:49:22 +03:00
|= [nam=term yak=yaki oth=(trel ship desk case) yuk=yaki]
2015-02-27 09:35:41 +03:00
^+ +>
2015-09-12 00:06:02 +03:00
%- emit
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-09-11 00:49:22 +03:00
%f %exec p.bob ~ [p.oth q.oth r.oth] %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
~
:- ~
:- [%$ %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-09-11 00:49:22 +03:00
(diff-bas(wat.dat %diff-ali) %ali ali.dat [p.ali q.ali cas.dat] bob.dat)
2015-02-27 09:35:41 +03:00
::
++ diffed-ali
2015-05-26 23:20:44 +03:00
|= res=gage
2015-02-27 09:35:41 +03:00
^+ +>
2015-05-26 23:20:44 +03:00
=+ tay=(gage-to-tage res)
?: ?=(%| -.tay)
(error:he %diff-ali-bad-made leaf/"merge diff ali failed" p.tay)
=+ can=(cages-to-map p.tay)
?: ?=(%| -.can)
(error:he %diff-ali p.can)
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 ^- (list (pair path lobe))
%+ murn (~(tap by q.bas.dat))
2015-04-20 23:42:18 +03:00
|= [pax=path lob=lobe]
^- (unit (pair path lobe))
2015-04-20 23:42:18 +03:00
=+ a=(~(get by q.ali.dat) pax)
=+ b=(~(get by q.bob.dat) pax)
?. ?& ?=(^ a)
!=([~ lob] a)
=([~ lob] b)
==
~
`[pax +.a]
2015-05-26 23:20:44 +03:00
=. can.dal.dat p.can
2015-02-27 09:35:41 +03:00
=. 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-09-11 00:49:22 +03:00
(diff-bas(wat.dat %diff-bob) %bob bob.dat [p.bob q.bob da/now] ali.dat)
2015-02-27 09:35:41 +03:00
::
++ diffed-bob
2015-05-26 23:20:44 +03:00
|= res=gage
2015-02-27 09:35:41 +03:00
^+ +>
2015-05-26 23:20:44 +03:00
=+ tay=(gage-to-tage res)
?: ?=(%| -.tay)
(error:he %diff-bob-bad-made leaf/"merge diff bob failed" p.tay)
=+ can=(cages-to-map p.tay)
?: ?=(%| -.can)
(error:he %diff-bob p.can)
2015-02-27 09:35:41 +03:00
?: ?=(%| -.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 ^- (list (pair path lobe))
%+ murn (~(tap by q.bas.dat))
2015-04-20 23:42:18 +03:00
|= [pax=path lob=lobe]
^- (unit (pair path lobe))
2015-04-20 23:42:18 +03:00
=+ a=(~(get by q.ali.dat) pax)
=+ b=(~(get by q.bob.dat) pax)
?. ?& ?=(^ b)
!=([~ lob] b)
=([~ lob] a)
==
~
`[pax +.b]
2015-05-26 23:20:44 +03:00
=. can.dob.dat p.can
2015-02-27 09:35:41 +03:00
=. 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)
2015-09-12 00:06:02 +03:00
%- emit(wat.dat %merge)
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-09-11 00:49:22 +03:00
%f %exec p.bob ~ [p.bob q.bob da/now] %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)
2015-08-14 03:11:59 +03:00
=+ ^= her
2015-02-27 09:35:41 +03:00
=+ (slag (dec (lent pax)) pax)
?~(- %$ i.-)
:- [%$ %path !>(pax)]
2015-08-14 03:11:59 +03:00
[%join her [%$ cal] [%$ cob]]
2013-09-29 00:21:18 +04:00
==
==
2015-02-27 09:35:41 +03:00
::
++ merged
2015-05-26 23:20:44 +03:00
|= res=gage
=+ tay=(gage-to-tage res)
?: ?=(%| -.tay)
(error:he %merge-bad-made leaf/"merging failed" p.tay)
=+ can=(cages-to-map p.tay)
?: ?=(%| -.can)
(error:he %merge p.can)
=+ bof=(~(run by p.can) (flit |=([a=mark ^] !?=(%null a))))
2015-02-27 09:35:41 +03:00
?: ?=(%| -.gon.dat)
+>.$
2015-04-21 02:36:19 +03:00
=. bof.dat bof
build
::
++ build
^+ .
2015-09-12 00:06:02 +03:00
%- emit(wat.dat %build)
2015-04-21 02:36:19 +03:00
:* 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-09-11 00:49:22 +03:00
%f %exec p.bob ~ [p.bob q.bob da/now] %tabl
2015-04-21 02:36:19 +03:00
^- (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
~
:- ~
:- [%$ %path !>(pax)]
2015-04-21 02:36:19 +03:00
=+ (~(get by q.bas.dat) pax)
?~ -
~| %mate-strange-diff-no-base
!!
[%pact (lobe-to-silk pax u.-) [%$ u.cay]]
2015-04-21 02:36:19 +03:00
==
::
++ built
2015-05-26 23:20:44 +03:00
|= res=gage
2015-04-21 02:36:19 +03:00
^+ +>
2015-05-26 23:20:44 +03:00
=+ tay=(gage-to-tage res)
?: ?=(%| -.tay)
(error:he %build-bad-made leaf/"delta building failed" p.tay)
=+ bop=(cages-to-map p.tay)
?: ?=(%| -.bop)
(error:he %built p.bop)
2015-04-21 02:36:19 +03:00
?: ?=(%| -.gon.dat)
+>.$
2015-05-26 23:20:44 +03:00
=. bop.dat p.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 :: change/del conflict
2015-02-27 09:35:41 +03:00
%- ~(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 :: change/del conflict
2015-02-27 09:35:41 +03:00
%- ~(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]
2015-05-14 23:28:25 +03:00
=^ hot lat.ran :: new content
2015-02-27 09:35:41 +03:00
^- [(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)]
:: ~& old=(~(run by old) mug)
:: ~& newdal=(~(run by new.dal.dat) mug)
:: ~& newdob=(~(run by new.dob.dat) mug)
:: ~& caldal=(~(run by cal.dal.dat) mug)
:: ~& caldob=(~(run by cal.dob.dat) mug)
:: ~& hot=(~(run by hot) mug)
:: ~& cas=(~(run by cas) mug)
2015-05-14 23:28:25 +03:00
=+ ^- hat=(map path lobe) :: all the content
2015-02-27 09:35:41 +03:00
%- ~(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-05-14 23:28:25 +03:00
%- ~(uni by hot)
2015-02-27 09:35:41 +03:00
cas
:: ~& > hat=(~(run by hat) mug)
2015-02-27 09:35:41 +03:00
=+ ^- del=(map path ,?)
(~(run by (~(uni by old.dal.dat) old.dob.dat)) |=(~ %|))
=. gon.dat [%& (sa (turn (~(tap by con)) head))]
2015-02-27 09:35:41 +03:00
=. 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)
2015-05-14 23:28:25 +03:00
^- (map path ,?)
%. |=(lobe %&)
%~ run by
%- ~(uni by new.dal.dat)
%- ~(uni by cal.dal.dat)
%- ~(uni by cas)
2015-05-14 23:28:25 +03:00
hot
2015-02-27 09:35:41 +03:00
checkout
::
++ checkout
^+ .
2015-09-08 23:15:40 +03:00
=+ ^- val=beak
?: ?=(%init gem.dat)
[p.ali q.ali cas.dat]
[p.bob q.bob da/now]
2015-09-12 00:06:02 +03:00
%- emit(wat.dat %checkout)
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-09-08 23:15:40 +03:00
%f %exec p.bob ~ val %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)
~
`[[%$ %path !>(pax)] (merge-lobe-to-silk:he pax lob)]
2015-02-27 09:35:41 +03:00
==
::
++ checked-out
2015-05-26 23:20:44 +03:00
|= res=gage
2015-02-27 09:35:41 +03:00
^+ +>
2015-05-26 23:20:44 +03:00
=+ tay=(gage-to-tage res)
?: ?=(%| -.tay)
(error:he %checkout-bad-made leaf/"merge checkout failed" p.tay)
=+ can=(cages-to-map p.tay)
?: ?=(%| -.can)
(error:he %checkout p.can)
2015-02-27 09:35:41 +03:00
?: ?=(%| -.gon.dat)
+>.$
=. let.dom +(let.dom)
=. hit.dom (~(put by hit.dom) let.dom r.new.dat)
2015-09-03 02:20:11 +03:00
=. ank.dat
%- checkout-ankh:ze
%- ~(run by (~(uni by bop.dat) p.can))
|=(cage [(page-to-lobe p q.q) +<])
2015-02-27 09:35:41 +03:00
=. ank.dom ank.dat
2015-08-14 03:11:59 +03:00
=> .(..wake wake)
?~ hez done:he
2015-06-12 06:52:42 +03:00
=+ mus=(must-ergo (turn (~(tap by erg.dat)) head))
?: =(~ mus) done:he
2015-02-27 09:35:41 +03:00
ergo
::
++ ergo
^+ .
2015-06-17 00:34:21 +03:00
=+ ^- sum=(set path)
=+ (must-ergo (turn (~(tap by erg.dat)) head))
=+ (turn (~(tap by -)) (corl tail tail))
%+ roll -
|= [pak=(set path) acc=(set path)]
(~(uni in acc) pak)
2015-02-27 09:35:41 +03:00
=+ zez=ze(ank.dom ank.dat)
2015-09-11 00:49:22 +03:00
=+ ^- val=beak
?: ?=(%init gem.dat)
[p.ali q.ali cas.dat]
[p.bob q.bob da/now]
2015-09-12 00:06:02 +03:00
%- emit(wat.dat %ergo)
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 ~]
2015-09-11 00:49:22 +03:00
%f %exec p.bob ~ val %tabl
2015-02-27 09:35:41 +03:00
^- (list (pair silk silk))
2015-06-17 00:34:21 +03:00
%+ turn (~(tap in sum))
|= a=path
2015-02-27 09:35:41 +03:00
^- (pair silk silk)
:- [%$ %path !>(a)]
2015-06-17 00:34:21 +03:00
=+ b=(~(got by erg.dat) a)
2015-02-27 09:35:41 +03:00
?. b
[%$ %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
2015-05-26 23:20:44 +03:00
|= res=gage
^+ +>
=+ tay=(gage-to-tage res)
?: ?=(%| -.tay)
(error:he %ergo-bad-made leaf/"merge ergo failed" p.tay)
2015-06-17 00:34:21 +03:00
=+ =| nac=mode
|- ^- tan=$&(mode [p=term q=tang])
2015-06-17 00:34:21 +03:00
?~ p.tay nac
2015-05-26 23:20:44 +03:00
=* pax p.i.p.tay
?. ?=(%path p.pax)
[%ergo >[%expected-path got=p.pax]< ~]
=* mim q.i.p.tay
=+ mit=?.(?=(%mime p.mim) ~ `((hard mime) q.q.mim))
2015-06-17 00:34:21 +03:00
$(p.tay t.p.tay, nac :_(nac [((hard path) q.q.pax) mit]))
2015-05-26 23:20:44 +03:00
?: ?=([@ *] tan) (error:he tan)
2015-06-17 00:34:21 +03:00
=+ `can=(map path (unit mime))`(mo tan)
2015-02-27 09:35:41 +03:00
?~ hez
(error:he %ergo-no-hez ~)
?: ?=(%| -.gon.dat)
+>.$
2015-09-12 00:06:02 +03:00
=+ mus=(must-ergo (turn (~(tap by erg.dat)) head))
=< done:he
%- emil
%+ turn (~(tap by mus))
|= [pot=term len=@ud pak=(set path)]
:* u.hez %give %ergo pot
%+ turn (~(tap in pak))
|= pax=path
[(slag len pax) (~(got by can) pax)]
2015-02-27 09:35:41 +03:00
==
::
2015-11-03 23:06:11 +03:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: This core is a small set of helper functions to assist in merging.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2015-02-27 09:35:41 +03:00
++ he
|%
++ done
^+ ..he
?< ?=(%| -.gon.dat)
..he(don |)
::
2015-02-27 09:35:41 +03:00
++ error
|= [err=term tan=(list tank)]
^+ ..he
..he(don |, gon.dat [%| err >ali< >bob< >cas.dat< >gem.dat< tan])
2015-02-27 09:35:41 +03:00
::
++ 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
::
2015-04-28 00:29:56 +03:00
++ merge-lobe-to-silk
|= [pax=path lob=lobe]
^- silk
=+ hat=q.ali.dat
=+ hot=q.bob.dat
=+ ^= lal
%+ biff alh
|= hal=ankh
(~(get by hat) pax)
=+ lol=(~(get by hot) pax)
|- ^- silk
?: =([~ lob] lol)
=+ (need (need (read-x let.dom pax)))
?> ?=(%& -<)
[%$ p.-]
2015-04-28 00:29:56 +03:00
?: =([~ lob] lal)
2015-09-06 04:14:00 +03:00
[%$ +:(need fil.ank:(descend-path:(zu (need alh)) pax))]
2015-04-28 00:29:56 +03:00
=+ bol=(~(got by lat.ran) lob)
?- -.bol
%direct [%volt q.bol]
%delta [%pact $(lob q.q.bol) [%volt r.bol]]
2015-04-28 00:29:56 +03:00
==
::
2015-02-27 09:35:41 +03:00
++ 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))
2015-06-12 21:24:14 +03:00
|-
2015-02-27 09:35:41 +03:00
^- (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)
$(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
--
--
2015-11-05 01:39:12 +03:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 4cA, filesystem vane
::
:: This is the arvo interface vane. Our formal state is a `++raft`, which
:: has five components:
::
:: -- `fat` is the state for all local desks.
:: -- `hoy` is the state for all foreign desks.
:: -- `ran` is the global, hash-addressed object store.
:: -- `mon` is the set of mount points in unix.
:: -- `hez` is the duct to the unix sync.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2015-02-27 09:35:41 +03:00
=| :: 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
%boat
:_ ..^$
[hen %give %hill (turn (~(tap by mon.ruf)) head)]~
2015-09-16 03:24:44 +03:00
::
%drop
=^ mos ruf
=+ den=((de now hen ruf) [. .]:p.q.hic q.q.hic)
abet:drop-me:den
[mos ..^$]
::
%info
?: =(%$ q.q.hic)
[~ ..^$]
=^ mos ruf
=+ den=((de now hen ruf) [. .]:p.q.hic q.q.hic)
abet:(exec:den now r.q.hic)
[mos ..^$]
::
2015-02-27 09:35:41 +03:00
%init
2015-08-14 03:11:59 +03:00
:_ %_ ..^$
fat.ruf
?< (~(has by fat.ruf) p.q.hic)
(~(put by fat.ruf) p.q.hic [-(hun hen)]:[*room .])
==
2015-05-18 04:56:59 +03:00
=+ [bos=(sein p.q.hic) can=(clan p.q.hic)]
%- zing ^- (list (list move))
2015-06-06 01:07:40 +03:00
:~ ?: =(bos p.q.hic) ~
2015-09-08 23:15:40 +03:00
[hen %pass /init-merge %c %merg p.q.hic %base bos %kids da/now %init]~
2015-05-18 04:56:59 +03:00
::
2015-05-18 06:26:38 +03:00
~
2015-05-18 04:56:59 +03:00
==
2015-02-27 09:35:41 +03:00
::
%into
2015-06-12 06:52:42 +03:00
=. hez.ruf `hen
2015-06-09 23:55:07 +03:00
:_ ..^$
=+ bem=(~(get by mon.ruf) p.q.hic)
?: &(?=(~ bem) !=(%$ p.q.hic))
2015-06-09 23:55:07 +03:00
~|([%bad-mount-point-from-unix p.q.hic] !!)
=+ ^- bem=beam
?^ bem
u.bem
[[?>(?=(^ fat.ruf) p.n.fat.ruf) %base %ud 1] ~]
2015-07-15 01:32:12 +03:00
=+ rom=(~(get by fat.ruf) p.bem)
?~ rom
~
=+ dos=(~(get by dos.u.rom) q.bem)
?~ dos
~
?: =(0 let.dom.u.dos)
2015-06-18 22:56:11 +03:00
=+ cos=(mode-to-soba ~ s.bem q.q.hic r.q.hic)
=+ ^- [one=(list ,[path miso]) two=(list ,[path miso])]
2015-09-06 04:14:00 +03:00
%+ skid cos
|= [a=path b=miso]
?& ?=(%ins -.b)
?=(%mime p.p.b)
=+ (slag (dec (lent a)) a)
?| =([%hook ~] -)
=([%hoon ~] -)
== ==
2015-09-06 04:14:00 +03:00
:~ [hen %pass /one %c %info p.bem q.bem %& one]
[hen %pass /two %c %info p.bem q.bem %& two]
2014-10-28 04:50:07 +03:00
==
2015-07-15 01:32:12 +03:00
=+ yak=(~(got by hut.ran.ruf) (~(got by hit.dom.u.dos) let.dom.u.dos))
2015-06-18 22:56:11 +03:00
=+ cos=(mode-to-soba q.yak (flop s.bem) q.q.hic r.q.hic)
2015-08-14 03:11:59 +03:00
[hen %pass /both %c %info p.bem q.bem %& cos]~
2015-02-27 09:35:41 +03:00
::
%merg :: direct state up
?: =(%$ q.q.hic)
[~ ..^$]
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [. .]:p.q.hic q.q.hic)
2015-09-08 23:15:40 +03:00
abet:abet:(start:(me:ze:den [r.q.hic s.q.hic] ~ &) t.q.hic u.q.hic)
2015-02-27 09:35:41 +03:00
[mos ..^$]
2015-06-12 06:52:42 +03:00
::
%mont
2015-06-29 22:31:33 +03:00
=. hez.ruf ?^(hez.ruf hez.ruf `[[%$ %sync ~] ~])
2015-06-12 06:52:42 +03:00
=+ pot=(~(get by mon.ruf) p.q.hic)
?^ pot
~& [%already-mounted pot]
[~ ..^$]
=. mon.ruf
(~(put by mon.ruf) p.q.hic [q.q.hic r.q.hic %ud 0] (flop s.q.hic))
=+ yar=(~(get by fat.ruf) q.q.hic)
?~ yar
[~ ..^$]
=+ dos=(~(get by dos.u.yar) r.q.hic)
?~ dos
[~ ..^$]
2015-08-14 03:11:59 +03:00
=^ mos ruf
=+ den=((de now hen ruf) [. .]:q.q.hic r.q.hic)
abet:(mont:den p.q.hic s.q.hic)
[mos ..^$]
2015-06-18 02:44:00 +03:00
::
%ogre
?~ hez.ruf
~& %no-sync-duct
[~ ..^$]
?@ p.q.hic
?. (~(has by mon.ruf) p.q.hic)
~& [%not-mounted p.q.hic]
[~ ..^$]
:_ ..^$(mon.ruf (~(del by mon.ruf) p.q.hic))
[u.hez.ruf %give %ogre p.q.hic]~
:_ %_ ..^$
mon.ruf
%- mo
%+ skip (~(tap by mon.ruf))
(corl (cury test p.q.hic) tail)
==
%+ turn
(skim (~(tap by mon.ruf)) (corl (cury test p.q.hic) tail))
|= [pot=term bem=beam]
[u.hez.ruf %give %ogre pot]
2015-02-27 09:35:41 +03:00
::
%warp
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) p.q.hic p.q.q.hic)
2015-09-05 03:15:05 +03:00
:: =- ~? ?=([~ %sing %w *] q.q.q.hic)
:: :* %someones-warping
:: rav=u.q.q.q.hic
:: mos=-<
:: ==
:: -
2015-08-14 03:11:59 +03:00
=< abet
?~ q.q.q.hic
ease:den
(eave:den u.q.q.q.hic)
2015-02-27 09:35:41 +03:00
[mos ..^$]
::
2015-06-23 01:03:34 +03:00
%west
?: ?=([%question *] q.q.hic)
=+ ryf=((hard riff) r.q.hic)
:_ ..^$
:~ [hen %give %mack ~]
:- hen
:^ %pass [(scot %p p.p.q.hic) (scot %p q.p.q.hic) t.q.q.hic]
%c
[%warp [p.p.q.hic p.p.q.hic] ryf]
==
?> ?=([%answer @ @ ~] q.q.hic)
=+ syd=(slav %tas i.t.q.q.hic)
=+ inx=(slav %ud i.t.t.q.q.hic)
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) p.q.hic syd)
abet:(take-foreign-update:den inx ((hard (unit rand)) r.q.hic))
[[[hen %give %mack ~] mos] ..^$]
2015-05-07 05:25:41 +03:00
::
%wegh
:_ ..^$ :_ ~
:^ hen %give %mass
2015-05-13 00:18:34 +03:00
:- %clay
2015-05-07 05:25:41 +03:00
:- %|
2015-05-13 00:18:34 +03:00
:~ domestic/`fat.ruf
foreign/`hoy.ruf
:- %object-store :- %|
:~ commits/`hut.ran.ruf
blobs/`lat.ran.ruf
==
2015-05-07 05:25:41 +03:00
==
2015-02-27 09:35:41 +03:00
==
::
2015-11-05 01:39:12 +03:00
:: All timers are handled by `%behn` nowadays.
2015-02-27 09:35:41 +03:00
++ doze
|= [now=@da hen=duct]
^- (unit ,@da)
~
::
++ load
|= old=[%0 ruf=raft]
^+ ..^$
..^$(ruf ruf.old)
::
++ scry :: inspect
2015-11-05 01:39:12 +03:00
:: Make a request
2015-02-27 09:35:41 +03:00
|= [fur=(unit (set monk)) ren=@tas his=ship syd=desk lot=coin tyl=path]
^- (unit (unit cage))
2015-05-02 04:26:59 +03:00
:: ~& scry/[ren `path`[(scot %p his) syd ~(rent co lot) tyl]]
:: =- ~& %scry-done -
2015-02-27 09:35:41 +03:00
=+ got=(~(has by fat.ruf) his)
=+ luk=?.(?=(%$ -.lot) ~ ((soft case) p.lot))
?~ luk [~ ~]
?: =(%$ ren)
[~ ~]
=+ run=((soft care) ren)
?~ run [~ ~]
2015-08-14 03:11:59 +03:00
=+ den=((de now [/scryduct ~] ruf) [. .]:his syd)
=+ (aver:den u.run u.luk tyl)
2015-03-31 01:12:18 +03:00
?~ - -
?~ 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
=+ dat=?-(+<.q.hin %writ [%& p.q.hin], %made [%| q.q.hin])
2015-04-28 00:29:56 +03:00
=+ ^- kan=(unit ankh)
%+ biff (~(get by fat.ruf) her)
|= room
%+ bind (~(get by dos) sud)
|= dojo
ank.dom
2015-08-14 03:11:59 +03:00
=^ mos ruf
=+ den=((de now hen ruf) [. .]:our syd)
abet:abet:(route:(me:ze:den [her sud] kan |) sat dat)
2015-08-14 03:11:59 +03:00
[mos ..^$]
2015-03-31 01:12:18 +03:00
?: ?=([%blab care @ @ *] tea)
?> ?=(%made +<.q.hin)
2015-06-12 21:24:14 +03:00
?. ?=(%& -.q.q.hin)
2015-03-31 01:12:18 +03:00
~| %blab-fail
2015-05-26 23:20:44 +03:00
~> %mean.|.(?+(-.q.q.hin -.q.q.hin %| p.q.q.hin))
!! :: interpolate ford fail into stack trace
2015-03-31 01:12:18 +03:00
:_ ..^$ :_ ~
:* 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-08-14 03:11:59 +03:00
=+ our=(slav %p i.t.tea)
2015-02-27 09:35:41 +03:00
=+ syd=(slav %tas i.t.t.tea)
=+ wen=(slav %da i.t.t.t.tea)
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [. .]:our syd)
abet:(take-inserting:den wen q.q.hin)
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)
2015-08-14 03:11:59 +03:00
=+ our=(slav %p i.t.tea)
2015-04-15 03:48:37 +03:00
=+ syd=(slav %tas i.t.t.tea)
=+ wen=(slav %da i.t.t.t.tea)
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [. .]:our syd)
abet:(take-diffing:den wen q.q.hin)
2015-04-25 02:35:24 +03:00
[mos ..^$]
::
%castifying
?> ?=([@ @ @ ~] t.tea)
2015-08-14 03:11:59 +03:00
=+ our=(slav %p i.t.tea)
2015-04-25 02:35:24 +03:00
=+ syd=(slav %tas i.t.t.tea)
=+ wen=(slav %da i.t.t.t.tea)
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [. .]:our syd)
abet:(take-castify:den wen q.q.hin)
2015-04-15 03:48:37 +03:00
[mos ..^$]
::
%mutating
?> ?=([@ @ @ ~] t.tea)
2015-08-14 03:11:59 +03:00
=+ our=(slav %p i.t.tea)
2015-02-27 09:35:41 +03:00
=+ syd=(slav %tas i.t.t.tea)
=+ wen=(slav %da i.t.t.t.tea)
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [. .]:our syd)
abet:(take-mutating:den wen q.q.hin)
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)
2015-08-14 03:11:59 +03:00
=+ our=(slav %p i.t.tea)
2015-02-27 09:35:41 +03:00
=+ syd=(slav %tas i.t.t.tea)
2014-10-28 22:59:26 +03:00
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [. .]:our syd)
abet:(take-patch:den q.q.hin)
2014-10-28 22:59:26 +03:00
[mos ..^$]
::
2015-02-27 09:35:41 +03:00
%ergoing
2015-06-13 03:48:16 +03:00
?> ?=([@ @ ~] t.tea)
2015-08-14 03:11:59 +03:00
=+ our=(slav %p i.t.tea)
2015-02-27 09:35:41 +03:00
=+ syd=(slav %tas i.t.t.tea)
2013-09-29 00:21:18 +04:00
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [. .]:our syd)
abet:(take-ergo:den q.q.hin)
2013-09-29 00:21:18 +04:00
[mos ..^$]
2015-03-04 04:05:41 +03:00
::
%foreign-plops
2015-06-13 03:23:08 +03:00
?> ?=([@ @ @ @ ~] t.tea)
2015-03-04 04:05:41 +03:00
=+ our=(slav %p i.t.tea)
=+ her=(slav %p i.t.t.tea)
=* syd i.t.t.t.tea
2015-06-13 03:23:08 +03:00
=+ lem=(slav %da i.t.t.t.t.tea)
2015-03-04 04:05:41 +03:00
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [our her] syd)
abet:(take-foreign-plops:den ?~(lem ~ `lem) q.q.hin)
[mos ..^$]
2015-05-14 23:28:25 +03:00
::
%foreign-x
?> ?=([@ @ @ @ @ *] t.tea)
=+ our=(slav %p i.t.tea)
=+ her=(slav %p i.t.t.tea)
=+ syd=(slav %tas i.t.t.t.tea)
=+ car=((hard care) i.t.t.t.t.tea)
=+ ^- cas=case
=+ (slay i.t.t.t.t.t.tea)
?> ?=([~ %$ case] -)
->+
=* pax t.t.t.t.t.t.tea
=^ mos ruf
2015-08-14 03:11:59 +03:00
=+ den=((de now hen ruf) [our her] syd)
abet:(take-foreign-x:den car cas pax q.q.hin)
[mos ..^$]
2013-09-29 00:21:18 +04:00
==
::
2015-06-04 00:18:13 +03:00
%mere
?: ?=(%& -.p.+.q.hin)
2015-06-09 18:23:40 +03:00
~& 'initial merge succeeded'
2015-06-04 00:18:13 +03:00
[~ ..^$]
~> %slog.
:^ 0 %rose [" " "[" "]"]
:^ leaf/"initial merge failed"
leaf/"my most sincere apologies"
>p.p.p.+.q.hin<
q.p.p.+.q.hin
[~ ..^$]
::
2015-04-30 01:48:45 +03:00
%note [[hen %give +.q.hin]~ ..^$]
2015-02-27 09:35:41 +03:00
%wake
2015-08-14 03:11:59 +03:00
~| %why-wakey !!
:: =+ 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))
2015-02-27 09:35:41 +03:00
::
%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-08-14 03:11:59 +03:00
:~ :* hen %pass /writ-wont %a
2015-06-23 01:03:34 +03:00
%wont [our him] [%c %answer t.t.tea]
2015-03-05 03:36:29 +03:00
(bind p.+.q.hin rant-to-rand)
==
2014-06-04 14:40:09 +04:00
==
2015-02-27 09:35:41 +03:00
::
2015-06-23 01:03:34 +03:00
%woot
?~ q.q.hin [~ ..^$]
~& [%clay-lost p.q.hin q.q.hin tea]
2015-02-27 09:35:41 +03:00
[~ ..^$]
==
2015-03-05 03:36:29 +03:00
::
++ rant-to-rand
|= rant
^- rand
[p q [p q.q]:r]
::
++ mode-to-soba
2015-06-18 22:56:11 +03:00
|= [hat=(map path lobe) pax=path all=? mod=mode]
2015-02-27 09:35:41 +03:00
^- soba
2015-06-18 22:56:11 +03:00
%+ welp
^- (list (pair path miso))
?. all
~
=+ mad=(mo mod)
=+ len=(lent pax)
=+ ^- descendants=(list path)
%+ turn
%+ skim (~(tap by hat))
|= [paf=path lob=lobe]
=(pax (scag len paf))
|= [paf=path lob=lobe]
(slag len paf)
%+ murn
descendants
|= pat=path
^- (unit (pair path ,[%del ~]))
?: (~(has by mad) pat)
~
`[(weld pax pat) %del ~]
^- (list (pair path miso))
%+ murn mod
|= [pat=path mim=(unit mime)]
^- (unit (pair path miso))
=+ paf=(weld pax pat)
?~ mim
=+ (~(get by hat) paf)
?~ -
~& [%deleting-already-gone pax pat]
2015-02-27 09:35:41 +03:00
~
2015-06-09 23:55:07 +03:00
`[paf %del ~]
=+ (~(get by hat) paf)
?~ -
2015-06-09 23:55:07 +03:00
`[paf %ins %mime -:!>(*mime) u.mim]
`[paf %mut %mime -:!>(*mime) u.mim]
2015-02-27 09:35:41 +03:00
--