urbit/arvo/clay.hoon

2967 lines
100 KiB
Plaintext
Raw Normal View History

!:
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.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2015-12-06 03:36:54 +03:00
|= pit+vase
2014-06-03 09:07:32 +04:00
=> |%
2015-02-27 09:35:41 +03:00
++ cane :: change set
2015-12-06 03:36:54 +03:00
_: new+(map path lobe) :: new files
cal+(map path lobe) :: old diffs
can+(map path cage) :: new diffs
old+(map path $~) :: deleted files
2015-02-27 09:35:41 +03:00
== ::
++ cult (map duct rove) :: subscriptions
2015-02-27 09:35:41 +03:00
++ dojo :: domestic desk state
2015-12-06 03:36:54 +03:00
_: 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
2015-12-06 03:36:54 +03:00
_: sor+(pair ship desk) :: merge source
hen+duct :: formal source
gem+germ :: strategy
wat+wait :: waiting on
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)
bof+(map path (unit cage)) :: conflict diffs
bop+(map path cage) :: conflict patches
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-02-27 09:35:41 +03:00
== ::
2015-12-06 03:36:54 +03:00
++ wait _? $null $ali $diff-ali $diff-bob :: what are we
$merge $build $checkout $ergo :: waiting for?
2015-09-05 03:15:05 +03:00
== ::
2015-12-06 03:36:54 +03:00
++ moot {p+case q+case r+path s+(map path lobe)} :: stored change range
++ move {p+duct q+(mold note gift)} :: local move
++ nako _: gar+(map aeon tako) :: new ids
let+aeon :: next id
lar+(set yaki) :: new commits
bar+(set plop) :: new content
2014-07-22 22:56:04 +04:00
== ::
2014-06-03 09:07:32 +04:00
++ note :: out request $->
2015-12-06 03:36:54 +03:00
_% _: $a :: to %ames
_% {$wont p+sock q+path r+*} ::
2014-06-22 02:06:42 +04:00
== == ::
2015-12-06 03:36:54 +03:00
_: $c :: to %clay
_% {$info p+@p q+@tas r+nori} :: internal edit
{$merg p+@p q+@tas r+@p s+@tas t+case u+germ} :: merge desks
{$warp p+sock q+riff} ::
2014-06-22 02:06:42 +04:00
== == ::
2015-12-06 03:36:54 +03:00
_: $d ::
_% {$flog p+{$crud p+@tas q+(list tank)}} :: to %dill
2015-02-27 09:35:41 +03:00
== == ::
2015-12-06 03:36:54 +03:00
_: $f ::
_% {$exec p+@p q+(unit {beak silk})} ::
2014-10-17 00:42:45 +04:00
== == ::
2015-12-06 03:36:54 +03: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 $<-
2015-12-06 03:36:54 +03:00
_? _: $a :: by %ames
_% {$woot p+ship q+coop} ::
2014-06-22 02:06:42 +04:00
== == ::
2015-12-06 03:36:54 +03:00
_: $c :: by %clay
_% {$note p+@tD q+tank} ::
{$mere p+(each (set path) (pair term tang))}
{$writ p+riot} ::
2015-02-27 09:35:41 +03:00
== == ::
2015-12-06 03:36:54 +03:00
_: $f ::
_% {$made p+@uvH q+gage} ::
2014-10-17 00:42:45 +04:00
== == ::
2015-12-06 03:36:54 +03:00
_: $t ::
_% {$wake $~} :: timer activate
2014-06-22 02:06:42 +04:00
== == ::
2015-12-06 03:36:54 +03:00
_: @tas :: by any
_% {$crud p+@tas q+(list tank)} ::
2014-06-22 02:06:42 +04:00
== == == ::
2014-06-11 18:06:36 +04:00
++ raft :: filesystem
2015-12-06 03:36:54 +03:00
_: fat+(map ship room) :: domestic
hoy+(map ship rung) :: foreign
ran+rang :: hashes
mon+(map term beam) :: mount points
hez+(unit duct) :: sync duct
2014-06-11 18:06:36 +04:00
== ::
++ rede :: universal project
2015-12-06 03:36:54 +03:00
_: lim+@da :: complete to
ref+(unit rind) :: outgoing requests
qyx+cult :: subscribers
dom+dome :: revision state
dok+(unit dork) :: outstanding diffs
mer+(unit mery) :: outstanding merges
2014-06-11 18:06:36 +04:00
== ::
++ rind :: request manager
2015-12-06 03:36:54 +03:00
_: 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
2015-12-06 03:36:54 +03:00
_: hun=duct :: terminal 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
2015-12-06 03:36:54 +03:00
_% {$sing p+mood} :: single request
{$next p+mood q+(unit (each cage lobe))} :: next version
{$many p+? q+moot} :: change range
2015-03-27 02:26:39 +03:00
== ::
2015-12-06 03:36:54 +03:00
++ rung _: rus+(map desk rede) :: neighbor desks
2014-06-11 18:06:36 +04:00
== ::
2015-12-06 03:36:54 +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-12-06 03:36:54 +03:00
ink+(list (pair path cage)) :: hoo{nk}
ins+(unit (list (pair path cage))) :: inserts
dig+(map path cage) :: store diffs
dif+(unit (list (trel path lobe cage))) :: changes
muc+(map path cage) :: store mutations
muh+(map path lobe) :: store hashes
mut+(unit (list (trel path lobe cage))) :: mutations
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-12-06 03:36:54 +03:00
|= {now+@da hen+duct raft}
|= {{our+@p her+@p} syd+desk}
2015-08-14 03:11:59 +03:00
=* ruf +>+<+>
=+ ^- {hun+(unit duct) rede}
2015-08-14 03:11:59 +03:00
=+ 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-12-06 03:36:54 +03:00
=| mow+(list move)
2015-02-27 09:35:41 +03:00
|%
++ abet
2015-12-06 03:36:54 +03:00
^- {(list move) raft}
2015-08-14 03:11:59 +03:00
:_ =+ 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-12-06 03:36:54 +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
::
2015-12-06 03:36:54 +03:00
++ ford-fail |=(tan+tang ~|(%ford-fail (mean tan)))
2015-05-26 04:17:59 +03:00
++ unwrap-tang
2015-12-06 03:36:54 +03:00
|* res+(each * tang)
?:(?=($& -.res) p.res (mean p.res))
2015-05-26 04:17:59 +03:00
::
++ gage-to-cages
2015-12-06 03:36:54 +03:00
|= gag+gage ^- (list (pair cage cage))
2015-05-26 04:17:59 +03:00
(unwrap-tang (gage-to-tage gag))
::
++ gage-to-success-cages
2015-12-06 03:36:54 +03:00
|= gag+gage
^- (list (pair cage cage))
2015-12-06 03:36:54 +03:00
?. ?=($tabl -.gag)
(ford-fail ?-(-.gag $| p.gag, $& [>%strange-gage p.p.gag<]~))
%+ murn p.gag
2015-12-06 03:36:54 +03:00
|= {key+gage val+gage} ^- (unit {cage cage})
?. ?=($& -.key)
(ford-fail ?-(-.key $| p.key, $tabl [>%strange-gage<]~))
?- -.val
2015-12-06 03:36:54 +03:00
$tabl (ford-fail >%strange-gage< ~)
{$&} (some [p.key p.val])
{$|} =. p.val [(sell q.p.key) p.val]
~> %slog.[0 %*(. >%ford-fail syd %her %why< |2.+> p.val)]
~
==
::
2015-05-26 04:17:59 +03:00
++ gage-to-tage
2015-12-06 03:36:54 +03:00
|= gag+gage
2015-05-26 04:17:59 +03:00
^- (each (list (pair cage cage)) tang)
?: ?=($| -.gag) (mule |.(`$~`(ford-fail p.gag)))
2015-12-06 03:36:54 +03:00
?. ?=($tabl -.gag)
(mule |.(`$~`(ford-fail >%strange-gage p.p.gag< ~)))
=< ?+(. [%& .] {@ *} .)
2015-12-06 03:36:54 +03:00
|- ^- ?((list {cage cage}) (each $~ tang))
2015-05-26 04:17:59 +03:00
?~ p.gag ~
=* hed i.p.gag
?- -.p.hed
$tabl (mule |.(`$~`(ford-fail >%strange-gage< ~)))
{$|} (mule |.(`$~`(ford-fail p.p.hed)))
2015-12-06 03:36:54 +03:00
{$&} ?- -.q.hed
$tabl (mule |.(`$~`(ford-fail >%strange-gage< ~)))
{$|} (mule |.(`$~`(ford-fail p.q.hed)))
2015-12-06 03:36:54 +03:00
{$&} =+ $(p.gag t.p.gag)
?+(- [[p.p p.q]:hed -] {@ *} -)
2015-05-26 04:17:59 +03:00
== ==
2015-03-11 00:09:53 +03:00
::
2015-05-26 23:20:44 +03:00
++ cages-to-map
2015-12-06 03:36:54 +03:00
|= tay+(list (pair cage cage))
=| can+(map path cage)
2015-05-26 23:20:44 +03:00
|- ^- (each (map path cage) tang)
?~ tay [%& can]
=* pax p.i.tay
2015-12-06 03:36:54 +03:00
?. ?=($path p.pax)
(mule |.(`$~`~|([%expected-path got=p.pax] !!)))
2015-05-26 23:20:44 +03:00
$(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
2015-12-06 03:36:54 +03:00
|= mof+move
2015-09-12 00:06:02 +03:00
%_(+> mow [mof mow])
::
++ emil
2015-12-06 03:36:54 +03:00
|= mof+(list move)
2015-09-12 00:06:02 +03:00
%_(+> mow (welp mof mow))
::
2015-04-28 03:46:55 +03:00
++ balk :: read and send
2015-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
|= {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
2015-12-06 03:36:54 +03:00
|= {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-12-06 03:36:54 +03:00
|= {hen+duct mun+mood dat+(each cage lobe)}
2015-02-27 09:35:41 +03:00
^+ +>
2015-12-06 03:36:54 +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-12-06 03:36:54 +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-12-06 03:36:54 +03:00
|= hen+duct
2015-09-12 00:06:02 +03:00
(emit hen %give %writ ~)
::
++ print-to-dill
2015-12-06 03:36:54 +03:00
|= {car+@tD tan+tank}
2015-09-12 00:06:02 +03:00
(emit (need hun) %give %note car tan)
::
++ send-over-ames
2015-12-06 03:36:54 +03:00
|= {a+duct b+path c+ship d+{p+@ud q+riff}}
2015-09-12 00:06:02 +03:00
(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-12-06 03:36:54 +03:00
|= rov+rove
2015-02-27 09:35:41 +03:00
^+ +>
=. 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-12-06 03:36:54 +03:00
?. ?=({$sing $v *} rav) rav
2015-03-27 02:26:39 +03:00
[%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
2015-12-06 03:36:54 +03:00
|= can+(list path)
^- (map term (pair @ud (set path)))
%- mo ^- (list (trel term @ud (set path)))
2015-06-12 06:52:42 +03:00
%+ murn (~(tap by mon))
2015-12-06 03:36:54 +03:00
|= {nam+term bem+beam}
^- (unit (trel term @ud (set path)))
2015-06-12 06:52:42 +03:00
=- ?~(- ~ `[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
2015-12-06 03:36:54 +03:00
|= {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)))
2015-12-06 03:36:54 +03:00
?: ?=($& -<)
2015-09-12 00:06:02 +03:00
[%$ 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-12-06 03:36:54 +03:00
|= rav+rave
2015-02-27 09:35:41 +03:00
^+ +>
?- -.rav
2015-12-06 03:36:54 +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
::
2015-12-06 03:36:54 +03:00
$next
2015-04-30 04:23:46 +03:00
=+ 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-12-06 03:36:54 +03:00
$many
2015-03-27 02:26:39 +03:00
=+ 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-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
{$|} (print-to-dill '=' %leaf :(weld (trip p.lem) " " (spud pre)))
{$&} |- ^+ +>.^$
?~ p.lem +>.^$
=. +>.^$
%+ print-to-dill
?-(-.q.i.p.lem $del '-', $ins '+', $dif ':')
2015-12-06 03:36:54 +03:00
:+ %rose ["/" "/" ~]
%+ turn (weld pre p.i.p.lem)
|= a=cord
?: ((sane %ta) a)
[%leaf (trip a)]
[%leaf (dash:ut (trip a) '\'')]
$(p.lem t.p.lem)
2015-02-27 09:35:41 +03:00
==
::
2015-11-10 02:54:28 +03:00
:: This is the entry point to the commit flow. It deserves some
:: explaining, since it's rather long and convoluted.
::
:: We take a `++nori`, which is either a label-add request or a `++soba`,
:: which is a list of changes. If it's a label, it's easy and we just pass
:: it to `++edit:ze`.
::
:: If the given `++nori` is a list of file changes, then we our goal is to
:: convert the list of `++miso` changes to `++misu` changes. In other
:: words, turn the `++nori` into a `++nuri`. Then, we pass it to
:: `++edit:ze`, which applies the changes to our state, and then we
:: check out the new revision. XX reword
::
:: Anyhow, enough of high-level wishy-washy talk. It's time to get down to
:: the nitty-gritty.
::
:: When we get a list of `++miso` changes, we split them into four types:
:: deletions, insertions, diffs (i.e. change from diff), and mutations
:: (i.e. change from new data). We do four different things with them.
::
:: For deletions, we just fill in `del` in `++dork` with a list of the
:: deleted files.
::
:: For insertions, we distinguish bewtween `%hoon` files and all other
:: files. For `%hoon` files, we just store them to `ink` in `++dork` so
:: that we add diff them directly. `%hoon` files have to be treated
:: specially to make the bootstrapping sequence work, since the mark
:: definitions are themselves `%hoon` files.
::
:: For the other files, we make a `%tabl` compound ford request to convert
:: the data for the new file to the the mark indicated by the last span in
:: the path.
::
:: For diffs, we make a `%tabl` compound ford request to apply the diff to
:: the existing content. We also store the diffs in `dig` in `++dork`.
::
:: For mutations, we make a `%tabl` compound ford request to convert the
:: given new data to the mark of the already-existing file. Later on in
:: `++take-castify` we'll create the ford request to actually perform the
:: diff. We also store the mutations in `muc` in `++dork`. I'm pretty
:: sure that's useless because who cares about the original data.
:: XX delete `muc`.
::
:: Finally, for performance reasons we cache any of the data that came in
:: as a `%mime` cage. We do this because many commits come from unix,
:: where they're passed in as `%mime` and need to be turned back into it
:: for the ergo. We cache both `%hoon` and non-`%hoon` inserts and
:: mutations.
::
:: At this point, the flow of control goes through the three ford requests
:: back to `++take-inserting`, `++take-diffing`, and `++take-castifying`,
:: which itself leads to `++take-mutating`. Once each of those has
:: completed, we end up at `++apply-edit`, where our unified story picks up
:: again.
2015-12-06 03:36:54 +03:00
::
2015-04-15 03:48:37 +03:00
++ edit :: apply changes
2015-12-06 03:36:54 +03:00
|= {wen+@da lem+nori}
2015-02-27 09:35:41 +03:00
^+ +>
2015-12-06 03:36:54 +03:00
?: ?=($| -.lem)
2015-02-27 09:35:41 +03:00
=^ 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))}
2015-04-17 03:22:39 +03:00
%+ skid `(list (pair path miso))`ins
|= {pax+path mis+miso}
2015-12-06 03:36:54 +03:00
?> ?=($ins -.mis)
?& ?=({_?($hoon $hook) *} (flop pax))
?=($mime p.p.mis)
2015-04-17 03:22:39 +03:00
==
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-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
|= {pax+path mis+miso}
?> ?=($dif -.mis)
2015-09-12 00:06:02 +03:00
=+ (need (need (read-x:ze let.dom pax)))
2015-12-06 03:36:54 +03:00
?> ?=($& -<)
2015-09-12 00:06:02 +03:00
:- [%$ %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
2015-12-06 03:36:54 +03:00
|= {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
:- ~
2015-12-06 03:36:54 +03:00
:* (turn del |=({pax+path mis+miso} ?>(?=($del -.mis) pax)))
2015-09-12 00:06:02 +03:00
::
%+ turn ink
2015-12-06 03:36:54 +03:00
|= {pax+path mis+miso}
2015-09-12 00:06:02 +03:00
^- (pair path cage)
2015-12-06 03:36:54 +03:00
?> ?=($ins -.mis)
2015-09-12 00:06:02 +03:00
=+ =>((flop pax) ?~(. %$ i))
2015-12-06 03:36:54 +03:00
[pax - [%atom %t] ((hard @t) +>.q.q.p.mis)]
2015-09-12 00:06:02 +03:00
::
~
::
2015-12-06 03:36:54 +03:00
(mo (turn dif |=({pax+path mis+miso} ?>(?=($dif -.mis) [pax p.mis]))))
2015-09-12 00:06:02 +03:00
::
~
::
2015-12-06 03:36:54 +03:00
(mo (turn mut |=({pax+path mis+miso} ?>(?=($mut -.mis) [pax p.mis]))))
2015-09-12 00:06:02 +03:00
::
~
::
~
::
%- mo ^- (list (pair path mime))
;: welp
^- (list (pair path mime))
%+ murn ins
|= {pax+path mis+miso}
2015-09-12 00:06:02 +03:00
^- (unit (pair path mime))
2015-12-06 03:36:54 +03:00
?> ?=($ins -.mis)
?. ?=($mime p.p.mis)
2015-09-12 00:06:02 +03:00
~
`[pax ((hard mime) q.q.p.mis)]
::
^- (list (pair path mime))
%+ murn ink
|= {pax+path mis+miso}
2015-09-12 00:06:02 +03:00
^- (unit (pair path mime))
2015-12-06 03:36:54 +03:00
?> ?=($ins -.mis)
?> ?=($mime p.p.mis)
2015-09-12 00:06:02 +03:00
`[pax ((hard mime) q.q.p.mis)]
::
^- (list (pair path mime))
%+ murn mut
|= {pax+path mis+miso}
2015-09-12 00:06:02 +03:00
^- (unit (pair path mime))
2015-12-06 03:36:54 +03:00
?> ?=($mut -.mis)
?. ?=($mime p.p.mis)
2015-09-12 00:06:02 +03:00
~
`[pax ((hard mime) q.q.p.mis)]
==
==
2015-04-14 03:29:54 +03:00
==
2015-02-27 09:35:41 +03:00
::
++ apply-edit
2015-12-06 03:36:54 +03:00
|= wen+@da
2015-02-27 09:35:41 +03:00
^+ +>
2015-12-06 03:36:54 +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]))
2015-04-15 03:48:37 +03:00
::
^- (list (pair path misu))
(turn u.dif.u.dok |=({pax+path cal+{lobe cage}} [pax %dif cal]))
2015-04-15 03:48:37 +03:00
::
^- (list (pair path misu))
(turn u.mut.u.dok |=({pax+path cal+{lobe cage}} [pax %dif cal]))
2015-04-15 03:48:37 +03:00
==
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-12-06 03:36:54 +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)
|= {pax+cage cay+cage}
2015-12-06 03:36:54 +03:00
?. ?=($path p.pax)
2015-04-15 03:48:37 +03:00
~|(%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-12-06 03:36:54 +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-12-06 03:36:54 +03:00
|= {pax+cage cay+cage}
2015-04-17 03:22:39 +03:00
^- (pair path (pair lobe cage))
2015-12-06 03:36:54 +03:00
?. ?=($path p.pax)
2015-04-15 03:48:37 +03:00
~|(%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-12-06 03:36:54 +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 +>.$
2015-12-06 03:36:54 +03:00
=+ ^- cat+(list (pair path cage))
2015-05-26 04:17:59 +03:00
%+ turn (gage-to-cages res)
2015-12-06 03:36:54 +03:00
|= {pax+cage cay+cage}
?. ?=($path p.pax)
2015-04-25 02:35:24 +03:00
~|(%castify-bad-path-mark !!)
[((hard path) q.q.pax) cay]
=. muh.u.dok
%- mo
%+ turn cat
2015-12-06 03:36:54 +03:00
|= {pax+path cay+cage}
2015-04-25 02:35:24 +03:00
[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
2015-12-06 03:36:54 +03:00
|= {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-12-06 03:36:54 +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-12-06 03:36:54 +03:00
|= {pax+cage cay+cage}
2015-04-15 03:48:37 +03:00
^- (unit (pair path (pair lobe cage)))
2015-12-06 03:36:54 +03:00
?. ?=($path p.pax)
2015-04-15 03:48:37 +03:00
~|(%clay-take-mutating-strange-path-mark !!)
2015-12-06 03:36:54 +03:00
?: ?=($null p.cay)
2015-04-15 03:48:37 +03:00
~
=+ 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-12-06 03:36:54 +03:00
|= res+gage
2015-02-27 09:35:41 +03:00
^+ +>
2015-04-14 00:29:39 +03:00
:: ~& %taking-patch
2015-12-06 03:36:54 +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-12-06 03:36:54 +03:00
=+ ^- sim+(list (pair path misu))
2015-04-17 03:22:39 +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-17 03:22:39 +03:00
::
^- (list (pair path misu))
(turn u.ins.u.dok |=({pax+path cay+cage} [pax %ins cay]))
2015-04-17 03:22:39 +03:00
::
^- (list (pair path misu))
(turn u.dif.u.dok |=({pax+path cal+{lobe cage}} [pax %dif cal]))
2015-04-17 03:22:39 +03:00
::
^- (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
==
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-12-06 03:36:54 +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)
2015-12-06 03:36:54 +03:00
|= {pax+cage cay+cage}
?. ?=($path-hash p.pax)
2015-05-26 04:17:59 +03:00
~|(%patch-bad-path-mark !!)
2015-12-06 04:43:57 +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-12-06 03:36:54 +03:00
=+ ^- sum+(set path)
2015-06-13 03:48:16 +03:00
=+ (turn (~(tap by mus)) (corl tail tail))
%+ roll -
2015-12-06 03:36:54 +03:00
|= {pak+(set path) acc+(set path)}
2015-06-13 03:48:16 +03:00
(~(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))
2015-12-06 03:36:54 +03:00
|= a+path
2015-09-12 00:06:02 +03:00
^- (pair silk silk)
:- [%$ %path !>(a)]
=+ b=(~(got by can) a)
2015-12-06 03:36:54 +03:00
?: ?=($del -.b)
2015-09-12 00:06:02 +03:00
[%$ %null !>(~)]
=+ (~(get by mim.u.dok) a)
?^ - [%$ %mime !>(u.-)]
:+ %cast %mime
=+ (need (need (read-x:ze let.dom a)))
2015-12-06 03:36:54 +03:00
?: ?=($& -<)
2015-09-12 00:06:02 +03:00
[%$ p.-]
(lobe-to-silk:ze a p.-)
2015-02-27 09:35:41 +03:00
==
::
2015-11-10 02:54:28 +03:00
:: See ++edit for a description of the commit flow.
2015-02-27 09:35:41 +03:00
++ take-ergo
2015-12-06 03:36:54 +03:00
|= res+gage
2015-02-27 09:35:41 +03:00
^+ +>
2015-12-06 03:36:54 +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-12-06 03:36:54 +03:00
=+ ^- can+(map path (unit mime))
2015-06-13 03:48:16 +03:00
%- mo ^- mode
%+ turn (gage-to-cages res)
2015-12-06 03:36:54 +03:00
|= {pax+cage mim+cage}
?. ?=($path p.pax)
2015-06-13 03:48:16 +03:00
~|(%ergo-bad-path-mark !!)
:- ((hard path) q.q.pax)
2015-12-06 03:36:54 +03:00
?. ?=($mime p.mim)
2015-06-13 03:48:16 +03:00
~
`((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))
2015-12-06 03:36:54 +03:00
|= {pot+term len+@ud pak+(set path)}
2015-09-12 00:06:02 +03:00
:* u.hez %give %ergo pot
%+ turn (~(tap in pak))
2015-12-06 03:36:54 +03:00
|= pax+path
2015-09-12 00:06:02 +03:00
[(slag len pax) (~(got by can) pax)]
2015-06-12 06:52:42 +03:00
==
2015-02-27 09:35:41 +03:00
::
2015-11-10 02:54:28 +03:00
:: See ++edit for a description of the commit flow.
2015-03-11 02:56:08 +03:00
++ checkout-ankh
2015-12-06 03:36:54 +03:00
|= hat+(map path lobe)
2015-02-27 09:35:41 +03:00
^+ +>
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))
2015-12-06 03:36:54 +03:00
|= {a+path b+lobe}
2015-09-12 00:06:02 +03:00
^- (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-12-06 03:36:54 +03:00
|= $^
_: lem+(unit @da) :: complete up to
gar+(map aeon tako) :: new ids
let+aeon :: next id
lar+(set yaki) :: new commits
bar+(set blob) :: new content
2015-03-04 04:05:41 +03:00
==
2015-02-27 09:35:41 +03:00
^+ +>
2015-08-14 03:11:59 +03:00
=< wake
2015-12-06 03:36:54 +03:00
=+ ^- nut+(map tako yaki)
2015-06-04 00:18:13 +03:00
%- mo ^- (list (pair tako yaki))
%+ turn (~(tap in lar))
2015-12-06 03:36:54 +03:00
|= yak+yaki
2015-06-04 00:18:13 +03:00
[r.yak yak]
2015-12-06 03:36:54 +03:00
=+ ^- nat+(map lobe blob)
2015-06-04 00:18:13 +03:00
%- mo ^- (list (pair lobe blob))
%+ turn (~(tap in bar))
2015-12-06 03:36:54 +03:00
|= bol+blob
2015-06-04 00:18:13 +03:00
[p.bol bol]
~| :* %bad-foreign-update
:* gar=gar
let=let
nut=(~(run by nut) $~)
nat=(~(run by nat) $~)
2015-06-04 00:18:13 +03:00
==
:* hitdom=hit.dom
letdom=let.dom
hutran=(~(run by hut.ran) $~)
latran=(~(run by lat.ran) $~)
2015-06-04 00:18:13 +03:00
==
==
=+ 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)
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-06-04 00:18:13 +03:00
~| [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
2015-12-06 03:36:54 +03:00
|= {wen+@da lem+nori}
2015-02-27 09:35:41 +03:00
^+ +>
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-12-06 03:36:54 +03:00
::
2015-03-04 04:05:41 +03:00
++ take-foreign-update :: external change
2015-12-06 03:36:54 +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-12-06 03:36:54 +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-12-06 03:36:54 +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-12-06 03:36:54 +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
2015-03-05 03:36:29 +03:00
~| %im-thinkin-its-prolly-a-bad-idea-to-request-rang-over-the-network
!!
::
$v
2015-03-05 03:36:29 +03:00
~| %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
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
?+ p.r.u.rut ~| %strange-w-over-nextwork !!
$aeon !>(((hard aeon) q.r.u.rut))
$null [[%atom %n] ~]
$nako !>(~|([%harding [&1 &2 &3]:q.r.u.rut] ((hard nako) q.r.u.rut)))
2015-03-05 03:36:29 +03:00
==
2015-12-06 03:36:54 +03:00
?. ?=($nako p.r.u.rut) [?>(?=(^ ref) .)]:wake
2015-06-13 03:23:08 +03:00
=+ rav=`rave`q.u.ruv
2015-12-06 03:36:54 +03:00
?> ?=($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
2015-12-06 03:36:54 +03:00
?.(?=($da -.q.q.rav) ~ `p.q.q.rav)
2015-06-13 03:23:08 +03:00
(need nak.u.ref)
=< ?>(?=(^ ref) .)
%^ validate-plops
[%ud let.dom]
2015-12-06 03:36:54 +03:00
?.(?=($da -.q.q.rav) ~ `p.q.q.rav)
2015-06-13 03:23:08 +03:00
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
2015-12-06 03:36:54 +03:00
|= {car+care cas+case pax+path peg+page}
2015-05-14 23:28:25 +03:00
^+ +>
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-12-06 03:36:54 +03:00
|= {car+care cas+case pax+path res+gage}
2015-05-14 23:28:25 +03:00
^+ +>
?> ?=(^ ref)
2015-12-06 03:36:54 +03:00
?. ?=($& -.res)
2015-06-01 23:46:36 +03:00
~| "validate foreign x failed"
=+ 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-12-06 03:36:54 +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
$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-12-06 03:36:54 +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))
|= {bob+cage cay+cage}
2015-12-06 03:36:54 +03:00
?. ?=($blob p.bob)
2015-05-26 23:20:44 +03:00
~| %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
$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
2015-12-06 03:36:54 +03:00
|* {rov+rove fun+_+(@da __(+>.^$))}
2015-02-27 09:35:41 +03:00
^+ +>.$
%- fall :_ +>.$
%- bind :_ fun
2015-12-06 03:36:54 +03:00
^- (unit @da)
2015-02-27 09:35:41 +03:00
?- -.rov
2015-12-06 03:36:54 +03:00
$sing
?. ?=($da -.q.p.rov) ~
2015-02-27 09:35:41 +03:00
`p.q.p.rov
2015-04-30 04:23:46 +03:00
::
2015-12-06 03:36:54 +03:00
$next ~
$many
2015-03-27 02:26:39 +03:00
=* mot q.rov
2015-02-27 09:35:41 +03:00
%+ hunt
2015-12-06 03:36:54 +03:00
?. ?=($da -.p.mot) ~
2015-02-27 09:35:41 +03:00
?.((lth now p.p.mot) ~ [~ p.p.mot])
2015-12-06 03:36:54 +03:00
?. ?=($da -.q.mot) ~
2015-02-27 09:35:41 +03:00
?.((lth now p.q.mot) [~ now] [~ p.q.mot])
==
::
++ reve
2015-12-06 03:36:54 +03:00
|= rov+rove
2015-02-27 09:35:41 +03:00
^- rave
2015-05-01 23:32:04 +03:00
?- -.rov
2015-12-06 03:36:54 +03:00
$sing rov
$next [- p]:rov
$many [%many p.rov p.q.rov q.q.rov r.q.rov]
2015-05-01 23:32:04 +03:00
==
2015-02-27 09:35:41 +03:00
::
++ rive
2015-12-06 03:36:54 +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) ~)
2015-12-06 03:36:54 +03:00
=| xaq+(list {p+duct q+rove})
2015-02-27 09:35:41 +03:00
|- ^+ ..wake
?~ xiq
..wake(qyx (~(gas by *cult) xaq))
?- -.q.i.xiq
2015-12-06 03:36:54 +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
2015-04-30 04:23:46 +03:00
=* 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
::
$many
2015-03-27 02:26:39 +03:00
=+ 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,
2015-12-06 03:36:54 +03:00
:: and content
2015-11-03 23:06:11 +03:00
:: -- 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-12-06 03:36:54 +03:00
|= a+lobe
2015-03-11 00:09:53 +03:00
=> (lobe-to-blob a)
?- -
2015-12-06 03:36:54 +03:00
$delta p.q
$direct p.q
2015-03-11 00:09:53 +03:00
==
2015-04-30 04:23:46 +03:00
++ lobe-to-silk :: XX maybe move hoo{n,k} stuff here
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-03-19 00:25:01 +03:00
^- silk
2015-12-06 03:36:54 +03:00
=+ ^- hat+(map path lobe)
2015-03-19 00:25:01 +03:00
?: =(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)))
2015-12-06 03:36:54 +03:00
?> ?=($& -<)
[%$ p.-]
2015-03-19 00:25:01 +03:00
=+ bol=(~(got by lat.ran) lob)
?- -.bol
2015-12-06 03:36:54 +03:00
$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
2015-12-06 03:36:54 +03:00
|= {one+(each cage lobe) two+(each cage lobe)}
2015-04-30 04:23:46 +03:00
^- ?
2015-12-06 03:36:54 +03:00
?: ?=($& -.one)
?: ?=($& -.two)
2015-04-30 04:23:46 +03:00
=([p q.q]:p.one [p q.q]:p.two)
=(p.two (page-to-lobe [p q.q]:p.one))
2015-12-06 03:36:54 +03:00
?: ?=($& -.two)
2015-04-30 04:23:46 +03:00
=(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-12-06 03:36:54 +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-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
|= {p+(list tako) q+(map path lobe) t+@da}
2015-02-27 09:35:41 +03:00
^- 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
2015-12-06 03:36:54 +03:00
|= lar+(list {p+path q+misu}) :: store changes
2015-02-27 09:35:41 +03:00
^- (map path blob)
=+ ^= hat :: current state
?: =(let.dom 0) :: initial commit
~ :: has nothing
=< q
%- aeon-to-yaki
let.dom
2015-12-06 03:36:54 +03:00
=- =+ sar=(sa (turn lar |=({p+path *} p))) :: changed paths
2015-02-27 09:35:41 +03:00
%+ roll (~(tap by hat) ~) :: find unchanged
=< .(bat bar)
2015-12-06 03:36:54 +03:00
|= {{pax+path gar+lobe} bat+(map path blob)}
2015-03-11 02:56:08 +03:00
?: (~(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-12-06 03:36:54 +03:00
|= {{pax+path mys+misu} bar+(map path blob)}
2015-02-27 09:35:41 +03:00
^+ bar
?- -.mys
2015-12-06 03:36:54 +03:00
$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-12-06 03:36:54 +03:00
?: &(?=($mime -.p.mys) =([%hook ~] (slag (dec (lent pax)) pax)))
2015-03-11 02:56:08 +03:00
`page`[%hook +.+.q.q.p.mys]
2015-12-06 03:36:54 +03:00
?: &(?=($mime -.p.mys) =([%hoon ~] (slag (dec (lent pax)) pax)))
2015-03-11 02:56:08 +03:00
`page`[%hoon +.+.q.q.p.mys]
2015-03-11 03:54:39 +03:00
[p q.q]:p.mys
2015-12-06 03:36:54 +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-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
|= lok+case :: act count through
2015-02-27 09:35:41 +03:00
^- (unit aeon)
?- -.lok
2015-12-06 03:36:54 +03:00
$da
2015-02-27 09:35:41 +03:00
?: (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
~| [%letdom let=let.dom hit=hit.dom hut=(~(run by hut.ran) $~)]
2015-03-07 00:07:34 +03:00
~| [%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-12-06 03:36:54 +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-12-06 03:36:54 +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-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
|= {wen+@da lem+nuri} :: edit
^- {(unit (map path lobe)) __(..ze)}
2015-02-27 09:35:41 +03:00
?- -.lem
2015-12-06 03:36:54 +03:00
{$&}
=^ 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
2015-12-06 03:36:54 +03:00
|= {p+(map path lobe) q+(map path lobe)}
2015-02-27 09:35:41 +03:00
^- ?
=- ?. qat %.n
%+ levy (~(tap by q) ~)
2015-12-06 03:36:54 +03:00
|= {pat+path lob+lobe}
2015-02-27 09:35:41 +03:00
(~(has by p) pat)
^= qat
%+ levy (~(tap by p) ~)
2015-12-06 03:36:54 +03:00
|= {pat+path lob+lobe}
2015-02-27 09:35:41 +03:00
=+ zat=(~(get by q) pat)
?~ zat %.n
=(u.zat lob)
:: =((lobe-to-cage u.zat) (lobe-to-cage lob))
::
++ forge-yaki :: forge-yaki:ze
2015-12-06 03:36:54 +03:00
|= {wen+@da par+(unit tako) lem+suba} :: forge yaki
2015-02-27 09:35:41 +03:00
=+ ^= 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
2015-12-06 03:36:54 +03:00
|= {yon+aeon pax+path} :: data at path
2015-02-27 09:35:41 +03:00
^- (map path lobe)
?: =(0 yon) ~
%- mo
%+ skim
%. ~
%~ tap by
=< q
%- aeon-to-yaki
yon
2015-12-06 03:36:54 +03:00
|= {p+path q+lobe}
?| ?=($~ pax)
?& !?=($~ p)
2015-02-27 09:35:41 +03:00
=(-.pax -.p)
$(p +.p, pax +.pax)
== ==
::
2015-03-06 04:19:54 +03:00
++ make-nako
2015-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
|= ren+_?($u $v $x $y $z) :: endpoint query
2015-02-27 09:35:41 +03:00
^- (unit cage)
?- ren
2015-12-06 03:36:54 +03:00
$u !! :: [~ %null [%atom %n] ~]
$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
2015-12-06 03:36:54 +03:00
|= {b+(set lobe) a+(set tako)} :: that aren't in b
2015-03-20 22:20:17 +03:00
^- (set lobe)
%+ roll (~(tap in a) ~)
2015-12-06 03:36:54 +03:00
|= {tak+tako bar+(set lobe)}
2015-03-20 22:20:17 +03:00
^- (set lobe)
=+ yak=(tako-to-yaki tak)
%+ roll (~(tap by q.yak) ~)
=< .(far bar)
2015-12-06 03:36:54 +03:00
|= {{path lob+lobe} far+(set lobe)}
2015-03-20 22:20:17 +03:00
^- (set lobe)
?~ (~(has in b) lob) :: don't need
far
=+ gar=(lobe-to-blob lob)
?- -.gar
2015-12-06 03:36:54 +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-12-06 03:36:54 +03:00
|= {a+(unit tako) b+tako}
^- {(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
2015-12-06 03:36:54 +03:00
|= p+tako :: XX slow
2015-02-27 09:35:41 +03:00
^- (set tako)
=+ y=(tako-to-yaki p)
%+ roll p.y
2015-07-15 01:32:12 +03:00
=< .(s (~(put in *(set tako)) p))
|= {q+tako s+(set tako)}
2015-02-27 09:35:41 +03:00
?: (~(has in s) q) :: already done
s :: hence skip
(~(uni in s) ^$(p q)) :: otherwise traverse
::
++ read :: read:ze
2015-12-06 03:36:54 +03:00
|= mun+mood :: read at point
2015-02-27 09:35:41 +03:00
^- (unit cage)
2015-12-06 03:36:54 +03:00
?: ?=($v p.mun)
2015-02-27 09:35:41 +03:00
[~ %dome !>(dom)]
2015-12-06 03:36:54 +03:00
?: &(?=($w p.mun) !?=($ud -.q.mun))
2015-02-27 09:35:41 +03:00
?^(r.mun ~ [~ %aeon !>(let.dom)])
2015-12-06 03:36:54 +03:00
?: ?=($w p.mun)
2015-02-27 09:35:41 +03:00
=+ ^= 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
2015-12-06 03:36:54 +03:00
|= {yon+aeon pax+path}
^- (unit (unit (each {$null (hypo $~)} lobe)))
2015-04-30 04:23:46 +03:00
=+ tak=(~(get by hit.dom) yon)
?~ tak
~
```[%null [%atom %n] ~]
::
2015-09-12 00:06:02 +03:00
++ read-v
2015-12-06 03:36:54 +03:00
|= {yon+aeon pax+path}
^- (unit (unit {$dome (hypo dome)}))
2015-09-12 00:06:02 +03:00
?: (lth yon let.dom)
~
?: (gth yon let.dom)
`~
``[%dome -:!>(*dome) dom]
::
++ read-x
2015-12-06 03:36:54 +03:00
|= {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-12-06 03:36:54 +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)
2015-12-06 03:36:54 +03:00
?: ?=($direct -.bol)
((hard @t) q.q.bol)
?> ?=($delta -.bol)
=+ txt=$(u.lob q.q.bol)
2015-12-06 03:36:54 +03:00
?> ?=($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
2015-12-06 03:36:54 +03:00
|= {yon+aeon pax+path}
^- (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)))
2015-12-06 03:36:54 +03:00
|= {paf+path lob+lobe}
=(pax (scag len paf))
2015-12-06 03:36:54 +03:00
|= {paf+path lob+lobe}
[(slag len paf) lob]
=+ us=(~(get by q.yak) pax)
2015-12-06 03:36:54 +03:00
:+ ?: &(?=($~ 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
2015-12-06 03:36:54 +03:00
|= {paf+path lob+lobe}
[?>(?=(^ paf) i.paf) ~]
::
2015-02-27 09:35:41 +03:00
++ read-at-aeon :: read-at-aeon:ze
2015-12-06 03:36:54 +03:00
|= {yon+aeon mun+mood} :: seek and read
2015-04-30 04:23:46 +03:00
^- (unit (unit (each cage lobe)))
2015-12-06 03:36:54 +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-12-06 03:36:54 +03:00
?: ?=($u p.mun)
2015-04-30 04:23:46 +03:00
(read-u yon r.mun)
2015-12-06 03:36:54 +03:00
?: ?=($v p.mun)
2015-09-12 00:06:02 +03:00
(bind (read-v yon r.mun) (curr bind (cury same %&)))
2015-12-06 03:36:54 +03:00
?: ?=($x p.mun)
(read-x yon r.mun)
2015-12-06 03:36:54 +03:00
?: ?=($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)
2015-12-06 03:36:54 +03:00
|= 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
2015-12-06 03:36:54 +03:00
|= 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-02-27 09:35:41 +03:00
~
~
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
2015-12-06 03:36:54 +03:00
|= {lag+(map path blob) sta+(map lobe blob)} :: fix lat
^- {(map lobe blob) (map path lobe)}
2015-02-27 09:35:41 +03:00
%+ roll (~(tap by lag) ~)
=< .(lut sta)
2015-12-06 03:36:54 +03:00
|= {{pat+path bar+blob} {lut+(map lobe blob) gar+(map path lobe)}}
2015-02-27 09:35:41 +03:00
?~ (~(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
2015-12-06 03:36:54 +03:00
|= ank+ankh :: filesystem state
=| ram+path :: reverse path into
2015-02-27 09:35:41 +03:00
|%
++ 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]
2015-12-06 03:36:54 +03:00
?: ?=($| -.dat)
~|(p.dat !!)
=+ dat=p.dat
2015-12-06 03:36:54 +03:00
=| don+? :: keep going
2015-02-27 09:35:41 +03:00
|%
++ 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-12-06 03:36:54 +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)]>) !!)
2015-12-06 03:36:54 +03:00
{$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-12-06 03:36:54 +03:00
|= {cas+case gem+germ}
2015-02-27 09:35:41 +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
2015-12-06 03:36:54 +03:00
|= rot+riot
2015-02-27 09:35:41 +03:00
^+ +>
?~ rot
(error:he %bad-fetch-ali ~)
=+ ^= dum
2015-12-06 03:36:54 +03:00
%- (hard {ank+* let+@ud hit+(map @ud tako) lab+(map @tas @ud)})
2015-02-27 09:35:41 +03:00
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
2015-12-06 03:36:54 +03:00
$init
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
::
2015-12-06 03:36:54 +03:00
$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
::
2015-12-06 03:36:54 +03:00
$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-12-06 03:36:54 +03:00
%- mo ^- (list {path ?})
2015-03-25 00:46:32 +03:00
%+ murn (~(tap by (~(uni by q.bob.dat) q.ali.dat)))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
^- (unit {path ?})
2015-03-25 00:46:32 +03:00
=+ 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
::
2015-12-06 03:36:54 +03:00
$fine
2015-09-11 03:25:27 +03:00
?: =(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
2015-12-06 03:36:54 +03:00
%- mo ^- (list {path ?})
2015-09-11 03:25:27 +03:00
%+ murn (~(tap by (~(uni by q.bob.dat) q.ali.dat)))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
^- (unit {path ?})
2015-09-11 03:25:27 +03:00
=+ 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
::
2015-12-06 03:36:54 +03:00
?($meet $mate $meld)
2015-02-27 09:35:41 +03:00
?: =(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 ~)
2015-12-06 03:36:54 +03:00
?. ?=({* $~ $~} r)
2015-02-27 09:35:41 +03:00
=+ (lent (~(tap in `(set yaki)`r)))
(error:he %merge-criss-cross >[-]< ~)
=. bas.dat n.r
2015-12-06 03:36:54 +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}
2015-04-18 10:31:58 +03:00
(~(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-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-04-18 10:31:58 +03:00
=+ (~(get by q.bas.dat) pax)
|(=(~ -) =([~ lob] -))
=. can.dal.dat
~
=. old.dal.dat
2015-12-06 03:36:54 +03:00
%- mo ^- (list {path $~})
2015-04-18 10:31:58 +03:00
%+ murn (~(tap by q.bas.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
^- (unit (pair path $~))
2015-04-18 10:31:58 +03:00
?. =(~ (~(get by q.ali.dat) pax))
~
`[pax ~]
=. new.dob.dat
%- mo
%+ skip (~(tap by q.bob.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-04-18 10:31:58 +03:00
(~(has by q.bas.dat) pax)
=. cal.dob.dat
%- mo
%+ skip (~(tap by q.bob.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-04-18 10:31:58 +03:00
=+ (~(get by q.bas.dat) pax)
|(=(~ -) =([~ lob] -))
=. can.dob.dat
~
=. old.dob.dat
2015-12-06 03:36:54 +03:00
%- mo ^- (list {path $~})
2015-04-18 10:31:58 +03:00
%+ murn (~(tap by q.bas.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
^- (unit (pair path $~))
2015-04-18 10:31:58 +03:00
?. =(~ (~(get by q.bob.dat) pax))
~
`[pax ~]
=+ ^= bof
%- %~ int by
2015-12-06 03:36:54 +03:00
%- ~(uni by `(map path *)`new.dal.dat)
%- ~(uni by `(map path *)`cal.dal.dat)
%- ~(uni by `(map path *)`can.dal.dat)
`(map path *)`old.dal.dat
2015-12-06 03:36:54 +03:00
%- ~(uni by `(map path *)`new.dob.dat)
%- ~(uni by `(map path *)`cal.dob.dat)
%- ~(uni by `(map path *)`can.dob.dat)
`(map path *)`old.dob.dat
2015-04-18 10:31:58 +03:00
?^ bof
(error:he %meet-conflict >(~(run by `(map path *)`bof) $~)< ~)
2015-04-18 10:31:58 +03:00
=+ ^- old=(map path lobe)
%+ roll (~(tap by (~(uni by old.dal.dat) old.dob.dat)))
=< .(old q.bas.dat)
2015-12-06 03:36:54 +03:00
|= {{pax+path $~} old+(map path lobe)}
2015-04-18 10:31:58 +03:00
(~(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
2015-12-06 03:36:54 +03:00
=+ ^- del+(map path ?)
(~(run by (~(uni by old.dal.dat) old.dob.dat)) |=($~ %|))
2015-04-18 10:31:58 +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)
2015-04-25 02:35:24 +03:00
=. erg.dat %- ~(uni by del)
2015-12-06 03:36:54 +03:00
^- (map path ?)
2015-04-25 02:35:24 +03:00
%. |=(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-12-06 03:36:54 +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))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-02-27 09:35:41 +03:00
^- (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-12-06 03:36:54 +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)
2015-12-06 03:36:54 +03:00
?: ?=($| -.tay)
2015-05-26 23:20:44 +03:00
(error:he %diff-ali-bad-made leaf/"merge diff ali failed" p.tay)
=+ can=(cages-to-map p.tay)
2015-12-06 03:36:54 +03:00
?: ?=($| -.can)
2015-05-26 23:20:44 +03:00
(error:he %diff-ali p.can)
2015-12-06 03:36:54 +03:00
?: ?=($| -.gon.dat)
2015-02-27 09:35:41 +03:00
+>.$
=. new.dal.dat
%- mo
%+ skip (~(tap by q.ali.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-02-27 09:35:41 +03:00
(~(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-12-06 03:36:54 +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
2015-12-06 04:43:57 +03:00
%- mo ^- (list {path $~})
2015-02-27 09:35:41 +03:00
%+ murn (~(tap by q.bas.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-02-27 09:35:41 +03:00
?. =(~ (~(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-12-06 03:36:54 +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)
2015-12-06 03:36:54 +03:00
?: ?=($| -.tay)
2015-05-26 23:20:44 +03:00
(error:he %diff-bob-bad-made leaf/"merge diff bob failed" p.tay)
=+ can=(cages-to-map p.tay)
2015-12-06 03:36:54 +03:00
?: ?=($| -.can)
2015-05-26 23:20:44 +03:00
(error:he %diff-bob p.can)
2015-12-06 03:36:54 +03:00
?: ?=($| -.gon.dat)
2015-02-27 09:35:41 +03:00
+>.$
=. new.dob.dat
%- mo
%+ skip (~(tap by q.bob.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-02-27 09:35:41 +03:00
(~(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-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
%- mo ^- (list {path $~})
2015-02-27 09:35:41 +03:00
%+ murn (~(tap by q.bas.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-02-27 09:35:41 +03:00
?. =(~ (~(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-12-06 03:36:54 +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)))
2015-12-06 03:36:54 +03:00
|= {pax+path *}
2015-02-27 09:35:41 +03:00
^- (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-12-06 03:36:54 +03:00
|= res+gage
2015-05-26 23:20:44 +03:00
=+ tay=(gage-to-tage res)
2015-12-06 03:36:54 +03:00
?: ?=($| -.tay)
2015-05-26 23:20:44 +03:00
(error:he %merge-bad-made leaf/"merging failed" p.tay)
=+ can=(cages-to-map p.tay)
2015-12-06 03:36:54 +03:00
?: ?=($| -.can)
2015-05-26 23:20:44 +03:00
(error:he %merge p.can)
=+ bof=(~(run by p.can) (flit |=({a+mark ^} !?=($null a))))
2015-12-06 03:36:54 +03:00
?: ?=($| -.gon.dat)
2015-02-27 09:35:41 +03:00
+>.$
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))
2015-12-06 03:36:54 +03:00
|= {pax+path cay+(unit cage)}
2015-04-21 23:23:50 +03:00
^- (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-12-06 03:36:54 +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)
2015-12-06 03:36:54 +03:00
?: ?=($| -.tay)
2015-05-26 23:20:44 +03:00
(error:he %build-bad-made leaf/"delta building failed" p.tay)
=+ bop=(cages-to-map p.tay)
2015-12-06 03:36:54 +03:00
?: ?=($| -.bop)
2015-05-26 23:20:44 +03:00
(error:he %built p.bop)
2015-12-06 03:36:54 +03:00
?: ?=($| -.gon.dat)
2015-04-21 02:36:19 +03:00
+>.$
2015-05-26 23:20:44 +03:00
=. bop.dat p.bop
=+ ^- con=(map path *) :: 2-change conflict
2015-02-27 09:35:41 +03:00
%- mo
2015-04-21 23:23:50 +03:00
%+ skim (~(tap by bof.dat))
2015-12-06 03:36:54 +03:00
|=({pax+path cay+(unit cage)} ?=($~ cay))
=+ ^- cas+(map path lobe) :: conflict base
2015-02-27 09:35:41 +03:00
%- ~(urn by con)
2015-12-06 03:36:54 +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)
2015-12-06 03:36:54 +03:00
%- mo ^- (list {path *})
2015-02-27 09:35:41 +03:00
%+ skim (~(tap by old.dal.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path $~}
2015-02-27 09:35:41 +03:00
?: (~(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)
2015-12-06 03:36:54 +03:00
%- mo ^- (list {path *})
2015-02-27 09:35:41 +03:00
%+ skim (~(tap by old.dob.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path $~}
2015-02-27 09:35:41 +03:00
?: (~(has by new.dal.dat) pax)
~| %strange-del-and-add
!!
(~(has by can.dal.dat) pax)
=. con :: add/add conflict
%- ~(uni by con)
2015-12-06 03:36:54 +03:00
%- mo ^- (list {path *})
2015-02-27 09:35:41 +03:00
%+ skip (~(tap by (~(int by new.dal.dat) new.dob.dat)))
2015-12-06 03:36:54 +03:00
|= {pax+path *}
2015-02-27 09:35:41 +03:00
=((~(got by new.dal.dat) pax) (~(got by new.dob.dat) pax))
2015-12-06 03:36:54 +03:00
?: &(?=($mate gem.dat) ?=(^ con))
=+ (turn (~(tap by `(map path *)`con)) |=({path *} >[+<-]<))
2015-02-27 09:35:41 +03:00
(error:he %mate-conflict -)
2015-12-06 03:36:54 +03:00
=+ ^- old+(map path lobe) :: oldies but goodies
2015-02-27 09:35:41 +03:00
%+ roll (~(tap by (~(uni by old.dal.dat) old.dob.dat)))
=< .(old q.bas.dat)
2015-12-06 03:36:54 +03:00
|= {{pax+path $~} old+(map path lobe)}
2015-02-27 09:35:41 +03:00
(~(del by old) pax)
2015-12-06 03:36:54 +03:00
=+ ^- can+(map path cage) :: content changes
2015-02-27 09:35:41 +03:00
%- mo
^- (list (pair path cage))
2015-04-21 23:23:50 +03:00
%+ murn (~(tap by bof.dat))
2015-12-06 03:36:54 +03:00
|= {pax+path cay+(unit cage)}
2015-02-27 09:35:41 +03:00
^- (unit (pair path cage))
?~ cay
~
`[pax u.cay]
2015-05-14 23:28:25 +03:00
=^ hot lat.ran :: new content
2015-12-06 03:36:54 +03:00
^- {(map path lobe) (map lobe blob)}
2015-02-27 09:35:41 +03:00
%+ roll (~(tap by can))
=< .(lat lat.ran)
2015-12-06 03:36:54 +03:00
|= {{pax+path cay+cage} hat+(map path lobe) lat+(map lobe blob)}
2015-02-27 09:35:41 +03:00
=+ ^= 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-12-06 03:36:54 +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)
=+ ^- 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-12-06 03:36:54 +03:00
^- (map path ?)
2015-05-14 23:28:25 +03:00
%. |=(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-12-06 03:36:54 +03:00
=+ ^- val+beak
?: ?=($init gem.dat)
2015-09-08 23:15:40 +03:00
[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))
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-04-21 23:23:50 +03:00
^- (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-12-06 03:36:54 +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)
2015-12-06 03:36:54 +03:00
?: ?=($| -.tay)
2015-05-26 23:20:44 +03:00
(error:he %checkout-bad-made leaf/"merge checkout failed" p.tay)
=+ can=(cages-to-map p.tay)
2015-12-06 03:36:54 +03:00
?: ?=($| -.can)
2015-05-26 23:20:44 +03:00
(error:he %checkout p.can)
2015-12-06 03:36:54 +03:00
?: ?=($| -.gon.dat)
2015-02-27 09:35:41 +03:00
+>.$
=. 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-12-06 03:36:54 +03:00
=+ ^- sum+(set path)
2015-06-17 00:34:21 +03:00
=+ (must-ergo (turn (~(tap by erg.dat)) head))
=+ (turn (~(tap by -)) (corl tail tail))
%+ roll -
2015-12-06 03:36:54 +03:00
|= {pak+(set path) acc+(set path)}
2015-06-17 00:34:21 +03:00
(~(uni in acc) pak)
2015-02-27 09:35:41 +03:00
=+ zez=ze(ank.dom ank.dat)
2015-12-06 03:36:54 +03:00
=+ ^- val+beak
?: ?=($init gem.dat)
2015-09-11 00:49:22 +03:00
[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-12-06 03:36:54 +03:00
|= res+gage
2015-05-26 23:20:44 +03:00
^+ +>
=+ tay=(gage-to-tage res)
2015-12-06 03:36:54 +03:00
?: ?=($| -.tay)
2015-05-26 23:20:44 +03:00
(error:he %ergo-bad-made leaf/"merge ergo failed" p.tay)
2015-12-06 03:36:54 +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
2015-12-06 03:36:54 +03:00
?. ?=($path p.pax)
2015-05-26 23:20:44 +03:00
[%ergo >[%expected-path got=p.pax]< ~]
=* mim q.i.p.tay
2015-12-06 03:36:54 +03:00
=+ 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-12-06 03:36:54 +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 ~)
2015-12-06 03:36:54 +03:00
?: ?=($| -.gon.dat)
2015-02-27 09:35:41 +03:00
+>.$
2015-09-12 00:06:02 +03:00
=+ mus=(must-ergo (turn (~(tap by erg.dat)) head))
=< done:he
%- emil
%+ turn (~(tap by mus))
2015-12-06 03:36:54 +03:00
|= {pot+term len+@ud pak+(set path)}
2015-09-12 00:06:02 +03:00
:* u.hez %give %ergo pot
%+ turn (~(tap in pak))
2015-12-06 03:36:54 +03:00
|= pax+path
2015-09-12 00:06:02 +03:00
[(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
2015-12-06 03:36:54 +03:00
?< ?=($| -.gon.dat)
..he(don |)
::
2015-02-27 09:35:41 +03:00
++ error
2015-12-06 03:36:54 +03:00
|= {err+term tan+(list tank)}
2015-02-27 09:35:41 +03:00
^+ ..he
..he(don |, gon.dat [%| err >ali< >bob< >cas.dat< >gem.dat< tan])
2015-02-27 09:35:41 +03:00
::
++ find-merge-points
2015-12-06 03:36:54 +03:00
|= {p+yaki q+yaki} :: maybe need jet
2015-02-27 09:35:41 +03:00
^- (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
2015-12-06 03:36:54 +03:00
|= {t+tako s+(set yaki)}
2015-02-27 09:35:41 +03:00
?: (~(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
2015-12-06 03:36:54 +03:00
|= {pax+path lob+lobe}
2015-04-28 00:29:56 +03:00
^- silk
=+ hat=q.ali.dat
=+ hot=q.bob.dat
=+ ^= lal
%+ biff alh
2015-12-06 03:36:54 +03:00
|= hal+ankh
2015-04-28 00:29:56 +03:00
(~(get by hat) pax)
=+ lol=(~(get by hot) pax)
|- ^- silk
?: =([~ lob] lol)
=+ (need (need (read-x let.dom pax)))
2015-12-06 03:36:54 +03:00
?> ?=($& -<)
[%$ 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
2015-12-06 03:36:54 +03:00
$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
2015-12-06 03:36:54 +03:00
|= unk+(set yaki) :: maybe need jet
=| gud+(set yaki)
2015-02-27 09:35:41 +03:00
=+ ^= zar
^- (map tako (set tako))
%+ roll (~(tap in unk))
2015-12-06 03:36:54 +03:00
|= {yak+yaki qar+(map tako (set tako))}
2015-02-27 09:35:41 +03:00
(~(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)) ~)
2015-12-06 03:36:54 +03:00
|= yak+yaki
2015-02-27 09:35:41 +03:00
!(~(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-12-06 03:36:54 +03:00
=| $^ :: instrument state
_: $0 :: vane version
ruf+raft :: revision tree
2015-02-27 09:35:41 +03:00
== ::
2015-12-06 03:36:54 +03:00
|= {now+@da eny+@ ski+sled} :: activate
2015-02-27 09:35:41 +03:00
^? :: opaque core
|% ::
++ call :: handle request
2015-12-06 03:36:54 +03:00
|= $^
_: hen+duct
hic+(hypo (hobo kiss))
2015-02-27 09:35:41 +03:00
==
=> %= . :: XX temporary
q.hic
^- kiss
2015-12-06 03:36:54 +03:00
?: ?=($soft -.q.hic)
2015-02-27 09:35:41 +03:00
=+
2015-12-06 03:36:54 +03:00
~|([%bad-soft (@t -.p.q.hic)] ((soft kiss) p.q.hic))
2015-02-27 09:35:41 +03:00
?~ -
2015-12-06 03:36:54 +03:00
~& [%bad-softing (@t -.p.q.hic)] !!
2015-02-27 09:35:41 +03:00
u.-
?: (~(nest ut -:!>(*kiss)) | p.hic) q.hic
2015-12-06 03:36:54 +03:00
~& [%clay-call-flub (@tas `*`-.q.hic)]
2015-02-27 09:35:41 +03:00
((hard kiss) q.hic)
==
2015-12-06 03:36:54 +03:00
^+ [p=*(list move) q=..^$]
2015-02-27 09:35:41 +03:00
?- -.q.hic
2015-12-06 03:36:54 +03:00
$boat
:_ ..^$
[hen %give %hill (turn (~(tap by mon.ruf)) head)]~
2015-09-16 03:24:44 +03:00
::
2015-12-06 03:36:54 +03:00
$drop
2015-09-16 03:24:44 +03:00
=^ mos ruf
=+ den=((de now hen ruf) [. .]:p.q.hic q.q.hic)
abet:drop-me:den
[mos ..^$]
::
2015-12-06 03:36:54 +03:00
$info
2015-09-16 03:24:44 +03:00
?: =(%$ 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-12-06 03:36:54 +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
::
2015-12-06 03:36:54 +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)
2015-12-06 03:36:54 +03:00
?: &(?=($~ 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)
2015-12-06 04:43:57 +03:00
=+ ^- {one+(list {path miso}) two+(list {path miso})}
2015-09-06 04:14:00 +03:00
%+ skid cos
2015-12-06 03:36:54 +03:00
|= {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
::
2015-12-06 03:36:54 +03:00
$merg :: direct state up
2015-02-27 09:35:41 +03:00
?: =(%$ 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
::
2015-12-06 03:36:54 +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
::
2015-12-06 03:36:54 +03:00
$ogre
2015-06-18 02:44:00 +03:00
?~ 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))
2015-12-06 03:36:54 +03:00
|= {pot+term bem+beam}
2015-06-18 02:44:00 +03:00
[u.hez.ruf %give %ogre pot]
2015-02-27 09:35:41 +03:00
::
2015-12-06 03:36:54 +03:00
$warp
2015-02-27 09:35:41 +03:00
=^ 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-12-06 03:36:54 +03:00
$west
?: ?=({$question *} q.q.hic)
2015-06-23 01:03:34 +03:00
=+ 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]
==
2015-12-06 03:36:54 +03:00
?> ?=({$answer @ @ $~} q.q.hic)
2015-06-23 01:03:34 +03:00
=+ 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
::
2015-12-06 03:36:54 +03:00
$wegh
2015-05-07 05:25:41 +03:00
:_ ..^$ :_ ~
:^ 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
2015-12-06 03:36:54 +03:00
|= {now+@da hen+duct}
^- (unit @da)
2015-02-27 09:35:41 +03:00
~
::
++ load
2015-12-06 03:36:54 +03:00
|= old+{$0 ruf+raft}
2015-02-27 09:35:41 +03:00
^+ ..^$
..^$(ruf ruf.old)
::
++ scry :: inspect
2015-12-06 03:36:54 +03:00
|= {fur+(unit (set monk)) ren+@tas his+ship syd+desk lot+coin tyl+path}
2015-02-27 09:35:41 +03:00
^- (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)
2015-12-06 03:36:54 +03:00
=+ luk=?.(?=($$ -.lot) ~ ((soft case) p.lot))
2015-02-27 09:35:41 +03:00
?~ 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.- -
2015-12-06 03:36:54 +03:00
?: ?=($& -.u.u.-) ``p.u.u.-
2015-03-31 01:12:18 +03:00
~
2015-02-27 09:35:41 +03:00
::
++ stay [%0 ruf]
++ take :: accept response
2015-12-06 03:36:54 +03:00
|= {tea+wire hen+duct hin+(hypo sign)}
^+ [p=*(list move) q=..^$]
?: ?=({$merge @ @ @ @ @ $~} tea)
?> ?=(?($writ $made) +<.q.hin)
2015-02-27 09:35:41 +03:00
=+ 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
2015-12-06 03:36:54 +03:00
=+ 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-12-06 03:36:54 +03:00
?: ?=({$blab care @ @ *} tea)
?> ?=($made +<.q.hin)
?. ?=($& -.q.q.hin)
2015-03-31 01:12:18 +03:00
~| %blab-fail
~> %mean.|.(?+(-.q.q.hin -.q.q.hin $| p.q.q.hin))
2015-05-26 23:20:44 +03:00
!! :: interpolate ford fail into stack trace
2015-03-31 01:12:18 +03:00
:_ ..^$ :_ ~
:* hen %give %writ ~
2015-12-06 03:36:54 +03:00
^- {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
2015-12-06 03:36:54 +03:00
$crud
2015-02-27 09:35:41 +03:00
[[[hen %slip %d %flog +.q.hin] ~] ..^$]
::
2015-12-06 03:36:54 +03:00
$made
2015-02-27 09:35:41 +03:00
?~ tea !!
?+ -.tea !!
2015-12-06 03:36:54 +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-12-06 03:36:54 +03:00
$diffing
?> ?=({@ @ @ $~} 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 ..^$]
::
2015-12-06 03:36:54 +03:00
$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 ..^$]
::
2015-12-06 03:36:54 +03:00
$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-12-06 03:36:54 +03:00
$patching
?> ?=({@ @ $~} 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-12-06 03:36:54 +03:00
$ergoing
?> ?=({@ @ $~} 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
::
2015-12-06 03:36:54 +03:00
$foreign-plops
?> ?=({@ @ @ @ $~} 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
::
2015-12-06 03:36:54 +03:00
$foreign-x
?> ?=({@ @ @ @ @ *} t.tea)
2015-05-14 23:28:25 +03:00
=+ 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} -)
2015-05-14 23:28:25 +03:00
->+
=* 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-12-06 03:36:54 +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-12-06 03:36:54 +03:00
$note [[hen %give +.q.hin]~ ..^$]
$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
::
2015-12-06 03:36:54 +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
::
$woot
2015-06-23 01:03:34 +03:00
?~ 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-12-06 03:36:54 +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))
2015-12-06 03:36:54 +03:00
|= {paf+path lob+lobe}
2015-06-18 22:56:11 +03:00
=(pax (scag len paf))
2015-12-06 03:36:54 +03:00
|= {paf+path lob+lobe}
2015-06-18 22:56:11 +03:00
(slag len paf)
%+ murn
descendants
2015-12-06 03:36:54 +03:00
|= pat+path
^- (unit (pair path {$del $~}))
2015-06-18 22:56:11 +03:00
?: (~(has by mad) pat)
~
`[(weld pax pat) %del ~]
^- (list (pair path miso))
%+ murn mod
2015-12-06 03:36:54 +03:00
|= {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
--