urbit/try/bin/merge.hoon

32 lines
756 B
Plaintext
Raw Normal View History

2014-05-20 22:53:49 +04:00
!:
:: /=try=/bin/merge/hoon
2014-05-31 02:59:58 +04:00
:: Call with two desks and an optional germ as a merge option
2014-05-20 22:53:49 +04:00
::
=> .(-< `who=@p`-<)
|= [est=time eny=@uw]
2014-05-31 02:59:58 +04:00
|= $: pes=[ses=span des=span cas=span ~]
pen=[sen=span den=span can=span ~]
gem=$|([germ ~] ~)
==
2014-05-20 22:53:49 +04:00
^- bowl
:_ ~
^- (list gift)
:_ ~
=+ vsr=((hard dome) .^(%cv pes))
=+ ves=((hard dome) .^(%cv pen))
2014-05-31 02:59:58 +04:00
=+ ^= sab ^- saba :*
(need (slaw 'p' sen.pen))
den.pen
[0 let.vsr]
(flop (turn hit.vsr |=(a=frog q.a)))
==
=+ lum=(~(auld ze est ves) ?~(gem %fine -.gem) sab)
2014-05-20 22:53:49 +04:00
?~ lum
2014-05-31 02:59:58 +04:00
^- gift
:* %la %leaf
"{(trip des.pes)} failed to merge, please rerun with a merge option"
==
2014-05-20 22:53:49 +04:00
?~ u.lum
`gift`[%la %leaf "{(trip den.pen)} is up to date"]
`gift`[%ok den.pen u.u.lum]