:merge rework

This commit is contained in:
Philip C Monk 2015-04-03 21:31:57 -04:00
parent ff6a9c3198
commit 76fd6824a6
4 changed files with 185 additions and 72 deletions

View File

@ -2,10 +2,16 @@
::
:::: /hook/core/sync/app
::
:: XX give %nice
|%
++ merge-state
$: auto=?
gem=germ
her=@p
sud=@tas
==
++ gift
$% [%nice ~]
$% [%mean p=ares]
[%nice ~]
[%rush %tang (list tank)]
==
++ move ,[p=bone q=(mold note gift)]
@ -15,95 +21,149 @@
== ==
$: %g
$% [%cide span]
[%mess p=[ship path] q=ship r=cage]
== == ==
++ sign
$% $: %c
$% [%mere are=(each (set path) (pair term (list tank)))]
== ==
$: %g
$% [%mean p=ares]
[%nice ~]
== == ==
--
!:
::::
::
|_ [hid=hide auto=? gem=germ syd=@tas her=@p sud=@tas]
|_ [hid=hide merges=(map desk merge-state)]
++ me
|= [ost=bone syd=desk]
=+ `merge-state`(fall (~(get by merges) syd) *merge-state)
=| mow=(list move)
|%
++ abet
[(flop mow) ..me(merges (~(put by merges) syd auto gem her sud))]
::
++ blab
|= new=(list move)
^+ +>
+>.$(mow (welp new mow))
::
++ end ?:(?=([* ~ ~] merges) . (blab [0 %pass / %g %cide %$] ~))
++ win end:(blab [ost %give %nice ~] ~)
++ lose end:(blab [ost %give %mean ~] ~)
::
++ merge
^+ .
(blab [ost %pass /[syd] %c %merg our.hid syd her sud gem] ~)
::
++ fancy-merge :: recurse
|= [syd=desk her=@p sud=desk gem=$|(%auto germ)]
^+ +>
%- blab :_ ~
:* ost %pass /[syd] %g %mess [our.hid imp.hid] our.hid
%merge-args !>([our.hid syd her sud gem ~])
==
::
++ spam (corl blab ^spam)
++ start
|= [her=@p sud=@tas gim=$|(%auto germ)]
^+ +>
?. ?=(%auto gim)
merge(auto |, gem gim, her her, sud sud)
?: =(0 .^(%cw /(scot %p our.hid)/[syd]/(scot %da lat.hid)))
=> $(gim %init)
.(auto &)
=> $(gim %fine)
.(auto &)
::
++ work
|= sih=sign
^+ +>
?: ?=(%meld gem)
?: ?=(%g -.sih)
?: ?=(%nice +<.sih)
=> (spam leaf/"set up scratch space" ~)
merge(syd (cat 3 syd '-scratch'))
=+ :- "failed to set up conflict resolution scratch space"
"I'm out of ideas"
lose:(spam leaf/-< leaf/-> ~)
?> ?=(%c -.sih)
?: ?=(%& -.are.sih)
?. auto
=+ "successfully merged with strategy {<gem>}"
win:(spam leaf/- ?~(p.are.sih ~ [>`(set path)`p.are.sih< ~]))
=+ (trip (cat 3 syd '-scratch'))
=+ ^- (list tape)
:~ "done setting up scratch space in %{-}"
"please resolve conflicts in the following files and run"
":merge %{(trip syd)} {<our.hid>} %{-}"
""
"conflicts in:"
==
win:(spam (welp (turn - (cury same %leaf)) [>p.are.sih< ~]))
=+ "failed to merge with strategy {<p.p.are.sih>}"
lose:(spam leaf/- q.p.are.sih)
?> ?=(%c -.sih)
?: ?=(%& -.are.sih)
=+ "successfully merged with strategy {<gem>}"
win:(spam leaf/- ?~(p.are.sih ~ [>`(set path)`p.are.sih< ~]))
?. auto
=+ "failed to merge with strategy {<p.p.are.sih>}"
lose:(spam leaf/- q.p.are.sih)
?+ gem
(spam leaf/"strange auto" >gem< ~)
::
%init
=+ :- "auto merge failed on strategy %init"
"I'm out of ideas"
lose:(spam leaf/-< leaf/-> [>p.p.are.sih< q.p.are.sih])
::
%fine
?. ?=(%bad-fine-merge p.p.are.sih)
=+ "auto merge failed on strategy %fine"
lose:(spam leaf/- >p.p.are.sih< q.p.are.sih)
=> (spam leaf/"%fine merge failed, trying %meet" ~)
merge(gem %meet)
::
%meet
?. ?=(%meet-conflict p.p.are.sih)
=+ "auto merge failed on strategy %meet"
lose:(spam leaf/- >p.p.are.sih< q.p.are.sih)
=> (spam leaf/"%meet merge failed, trying %mate" ~)
merge(gem %mate)
::
%mate
?. ?=(%mate-conflict p.p.are.sih)
=+ "auto merge failed on strategy %mate"
lose:(spam leaf/- >p.p.are.sih< q.p.are.sih)
=> .(gem %meld)
=+ tic=(cat 3 syd '-scratch')
=> =+ "%mate merge failed with conflicts, %melding into %{(trip tic)}"
[tic=tic (spam leaf/- ~)]
(fancy-merge tic our.hid syd %auto)
==
--
++ peer ,_`.
++ poke--args
|= [ost=bone you=ship syd=@tas her=@p sud=@tas gim=?([$|(%auto germ) ~] ~)]
^- [(list move) _+>.$]
?~ gim
$(gim [%auto ~])
?. ?=(%auto -.gim)
=: auto |
gem -.gim
^syd syd
^her her
^sud sud
==
[[(merge ost) ~] +>.$]
=. auto &
?: =(0 .^(%cw /(scot %p our.hid)/[syd]/(scot %da lat.hid)))
=> $(-.gim %init)
[- +(auto &)]
=> $(-.gim %fine)
[- +(auto &)]
abet:(start:(me ost syd) her sud -.gim)
::
++ pour
|= [ost=bone pax=path sih=*]
^- [(list move) _+>.$]
=+ ((soft ,[%c %mere are=(each (set path) (pair term (list tank)))]) sih)
=+ ((soft sign) sih)
?~ -
[(spam leaf/"not working so well" >sih< ~) +>.$]
?: ?=(%& -.are.u)
%+ end
leaf/"successfully merged with strategy {<gem>}"
?~(p.are.u ~ [>`(set path)`p.are.u< ~])
?. auto
(end leaf/"failed to merge with strategy {<p.p.are.u>}" q.p.are.u)
?+ gem
[(spam leaf/"strange auto" >gem< ~) +>.$]
::
%init
%^ end
leaf/"auto merge failed on strategy %init"
leaf/"I'm out of ideas"
[>p.p.are.u< q.p.are.u]
::
%fine
?. ?=(%bad-fine-merge p.p.are.u)
(end leaf/"auto merge failed on strategy %fine" >p.p.are.u< q.p.are.u)
=> .(gem %meet)
:_ +>.$
(flop i=(merge ost) t=(spam leaf/"%fine merge failed, trying %meet" ~))
::
%meet
?. ?=(%meet-conflict p.p.are.u)
(end leaf/"auto merge failed on strategy %meet" >p.p.are.u< q.p.are.u)
=> .(gem %mate)
:_ +>.$
(flop i=(merge ost) t=(spam leaf/"%meet merge failed, trying %mate" ~))
%mate
::
?. ?=(%mate-conflict p.p.are.u)
(end leaf/"auto merge failed on strategy %mate" >p.p.are.u< q.p.are.u)
=> .(gem %meld)
:_ +>.$
(flop i=(merge ost) t=(spam leaf/"%mate merge failed, trying %meld" ~))
::
%meld
%^ end
leaf/"auto merge failed on strategy %meld"
leaf/"I'm out of ideas"
[>p.p.are.u< q.p.are.u]
==
::
++ merge
|= ost=bone
^- move
[ost %pass / %c %merg our.hid syd her sud gem]
abet:(work:(me ost -.pax) u)
::
++ spam
|= mes=(list tank)
^- (list move)
%+ turn (~(tap in (~(get ju pus.hid) /out)))
|= ost=bone
[ost %give %rush %tang mes]
::
++ end
|= mes=(list tank)
^- [(list move) _+>.$]
[(flop i=[0 %pass / %g %cide %$] t=(spam mes)) +>.$]
--

View File

@ -1174,8 +1174,6 @@
++ make-nako
|= [a=aeon b=aeon]
^- nako
~& > %making-nako
=- ~& > %made-nako -
:+ hit.dom
let.dom
(data-twixt-takos (~(get by hit.dom) a) (aeon-to-tako b))

View File

@ -72,6 +72,7 @@
[%dude p=tank q=silk] :: error wrap
[%dune p=(set beam) q=(unit gage)] :: unit literal
[%join p=mark q=silk r=silk] :: merge
[%mash p=mark q=silk r=silk] :: merge
[%mute p=silk q=(list (pair wing silk))] :: mutant
[%pact p=silk q=silk] :: patch
[%plan p=beam q=spur r=hood] :: structured assembly
@ -707,6 +708,49 @@
(fine cof u.fom (slot 3 dif))
==
::
++ mash
|= [cof=cafe for=mark kas=silk kos=silk]
^- (bolt gage)
%. [cof kas kos]
;~ cope
;~ coax
|=([cof=cafe p=silk q=silk] (make cof p))
|=([cof=cafe p=silk q=silk] (make cof q))
==
|= [cof=cafe cay=gage coy=gage]
?. &(?=(@ p.cay) ?=(@ p.coy))
(flaw cof leaf/"bad mash marc: {<p.cay>} {<p.coy>}" ~)
%+ cope (fang cof for)
|= [cof=cafe pro=vase]
?. (slab %grad p.pro)
(flaw cof leaf/"no ++grad" ~)
=+ gar=(slap pro [%cnzy %grad])
?. (slab %form p.gar)
?. (slab %sted p.gar)
(flaw cof leaf/"no ++form:grad nor ++sted:grad" ~)
=+ too=((soft ,@tas) q:(slap gar [%cnzy %sted]))
?~ too
(flaw cof leaf/"bad ++sted:grad" ~)
(make cof %mash u.too [%done ~ cay] [%done ~ coy])
=+ fom=((soft ,@tas) q:(slap gar [%cnzy %form]))
?~ fom
(flaw cof leaf/"bad ++form:grad" ~)
?. &(=(u.fom p.cay) =(u.fom p.coy))
%+ flaw cof :_ :_ ~
leaf/"mash on data of bad marks: {(trip p.cay)} {(trip p.coy)}"
leaf/"expected mark {(trip u.fom)}"
?: =(q.q.cay q.q.coy)
(fine cof cay)
?. (slab %mash p.gar)
(fine cof %null [%atom %n] ~)
%+ cope
%^ maul cof
(slap (slap pro [%cnzy %grad]) [%cnzy %mash])
(slop q.cay q.coy)
|= [cof=cafe dif=vase]
(fine cof u.fom dif)
==
::
++ kale :: mutate
|= [cof=cafe kas=silk muy=(list (pair wing silk))]
^- (bolt gage)
@ -1051,6 +1095,12 @@
|.
leaf/"ford: join {<p.kas>} {<`@p`(mug q.kas)>} {<`@p`(mug r.kas)>}"
(join cof p.kas q.kas r.kas)
::
%mash
%+ cool
|.
leaf/"ford: mash {<p.kas>} {<`@p`(mug q.kas)>} {<`@p`(mug r.kas)>}"
(mash cof p.kas q.kas r.kas)
::
%mute (kale cof p.kas q.kas)
%pact

View File

@ -84,5 +84,10 @@
$(wig [[%| (welp p.i.wig p.i.t.wig) (welp q.i.wig q.i.t.wig)] t.t.wig])
[i.wig $(wig t.wig)]
--
::
++ mash
|= [ali=(urge cord) bob=(urge cord)]
^- (urge cord)
(fall (join ali bob) ali)
--
--