mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-21 13:51:50 +03:00
story: generators improvements
- use desk parameter instead of %base everywhere - formatting clean up - make |story-remove take a case instead of an aeon - make desk param optional for story-set and story-log
This commit is contained in:
parent
5346784609
commit
ce0fa85e18
@ -13,9 +13,9 @@
|
||||
=? desk =(*^desk desk) q.bec :: use current desk if user didn't provide
|
||||
=/ existing-story .^(? %cu /(scot %p our)/[desk]/(scot %da now)/story)
|
||||
?: ?&(existing-story !overwrite)
|
||||
~& >> "Error: {<desk>}/story already exists. Set the optional parameter `overwrite` to `%.y` to forcibly wipe"
|
||||
~& >> "Error: /{(trip (slav %tas desk))}/story already exists. Set the optional parameter `overwrite` to `%.y` to forcibly overwrite."
|
||||
:: XX could use a better way to noop
|
||||
:- %helm-pass [%d %noop ~]
|
||||
helm-pass+[%d %noop ~]
|
||||
=| tale=story
|
||||
:- %helm-pass
|
||||
[%c [%info desk %& [/story %ins story+!>(tale)]~]]
|
@ -4,14 +4,19 @@
|
||||
/- *story
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[[syd=desk =aeon:clay ~] ~]
|
||||
[[syd=desk ~] cas=case ~]
|
||||
==
|
||||
::
|
||||
:: Remove a commit message to a given case on a given desk
|
||||
:: Remove any commit message(s) for a given case and desk
|
||||
::
|
||||
:: XX: story set and story init both have desk and case as optional.
|
||||
:: however, it seems a bit odd to allow both optional here
|
||||
:: since we're dealing with a more hazardous operation.
|
||||
:: should we allow a bare `|story-remove` to remove the last commit message on the current desk?
|
||||
:: leaning towards no, and potentially even making the case non-optional
|
||||
=/ our p.bec
|
||||
:: XX should `base` here be syd or q.bec
|
||||
=/ tak .^(tako:clay %cs /(scot %p our)/base/(scot %ud aeon)/tako/~)
|
||||
=? cas =(*case cas) da+now :: use current commit if cas not provided
|
||||
=/ tak .^(tako:clay %cs /(scot %p our)/[syd]/(scot cas)/tako/~)
|
||||
=/ tale=story .^(story %cx /(scot %p our)/[syd]/(scot %da now)/story)
|
||||
=. tale (~(del ju tale) tak)
|
||||
:- %helm-pass
|
||||
|
@ -4,15 +4,16 @@
|
||||
/- *story
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[[syd=desk =prose ~] cas=case ~]
|
||||
[[=prose ~] =desk cas=case ~]
|
||||
==
|
||||
::
|
||||
:: Add a commit message to a given case on a given desk (modifies in place)
|
||||
:: Add a commit message to a given case on a given desk. Stores conflicting messages.
|
||||
::
|
||||
=/ our p.bec
|
||||
=? cas =(*case cas) [%da now] :: set current commit when cas not provided
|
||||
=/ tak .^(tako:clay %cs /(scot %p our)/[syd]/(scot cas)/tako/~)
|
||||
=/ tale=story .^(story %cx /(scot %p our)/[syd]/(scot %da now)/story)
|
||||
=? desk =(*^desk desk) q.bec :: use current desk if user didn't provide
|
||||
=? cas =(*case cas) da+now :: use current commit if cas not provided
|
||||
=/ tak .^(tako:clay %cs /(scot %p our)/[desk]/(scot cas)/tako/~)
|
||||
=/ tale=story .^(story %cx /(scot %p our)/[desk]/(scot %da now)/story)
|
||||
=. tale (~(put ju tale) tak prose)
|
||||
:- %helm-pass
|
||||
[%c [%info syd %& [/story %ins story+!>(tale)]~]]
|
||||
[%c [%info desk %& [/story %ins story+!>(tale)]~]]
|
@ -7,9 +7,9 @@
|
||||
[[syd=desk ~] ~]
|
||||
==
|
||||
::
|
||||
:: List all commit messages for the given desk
|
||||
:: (Internal) List all commit messages for the given desk,
|
||||
:: including orphans (i.e. ones that have no connection to the file graph)
|
||||
::
|
||||
:: TODO remove this outdated generator, superseded by story-log
|
||||
=/ our p.bec
|
||||
=/ tale=story .^(story %cx /(scot %p our)/[syd]/(scot %da now)/story)
|
||||
=/ story-to-mime .^($-(story mime) %cf /(scot %p our)/[syd]/(scot %da now)/story/mime)
|
||||
|
@ -5,28 +5,17 @@
|
||||
/+ lib=story
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[[syd=desk ~] ~]
|
||||
[[~] =desk ~]
|
||||
==
|
||||
|^
|
||||
=/ our p.bec
|
||||
=/ cas `case`[%da now]
|
||||
=/ tale .^(story %cx /(scot %p our)/[syd]/(scot %da now)/story)
|
||||
=/ current-tako .^(tako:clay %cs /(scot %p our)/[syd]/(scot cas)/tako/~)
|
||||
=/ current-yaki .^(yaki:clay %cs /(scot %p our)/base/(scot cas)/yaki/(scot %uv current-tako))
|
||||
=? desk =(*^desk desk) q.bec :: use current desk if user didn't provide
|
||||
=/ cas=case da+now
|
||||
=/ tale .^(story %cx /(scot %p our)/[desk]/(scot %da now)/story)
|
||||
=/ current-tako .^(tako:clay %cs /(scot %p our)/[desk]/(scot cas)/tako/~)
|
||||
=/ current-yaki .^(yaki:clay %cs /(scot %p our)/[desk]/(scot cas)/yaki/(scot %uv current-tako))
|
||||
:- %tang
|
||||
(story-log current-yaki tale)
|
||||
::
|
||||
++ msg-from-commit
|
||||
|= [commit=yaki:clay tale=story]
|
||||
^- (unit cord)
|
||||
=/ proses (~(get by tale) r.commit)
|
||||
?~ proses ~
|
||||
%- some
|
||||
%- crip
|
||||
;: welp
|
||||
(tako-to-text:lib r.commit)
|
||||
(proses-to-text:lib u.proses)
|
||||
==
|
||||
(story-log [our desk] current-yaki tale)
|
||||
::::
|
||||
:: Remarks:
|
||||
::
|
||||
@ -35,12 +24,12 @@
|
||||
:: 2. the inner loop, `ancestor-loop`, which threads left-to-right on reverse-ancestors
|
||||
::::
|
||||
++ story-log
|
||||
|= [current-commit=yaki:clay tale=story]
|
||||
|= [[our=ship syd=^desk] current-commit=yaki:clay tale=story]
|
||||
^- tang
|
||||
=/ our p.bec
|
||||
=/ cas=case [%da now]
|
||||
%- flop
|
||||
%- head
|
||||
=/ cas=case da+now
|
||||
::
|
||||
%- flop :: least-recent-first -> most-recent-first
|
||||
%- head :: result from state
|
||||
=| state=[result=tang mergebase=(unit tako:clay)]
|
||||
|-
|
||||
^- _state
|
||||
@ -56,18 +45,20 @@
|
||||
::
|
||||
[tako:clay ~]
|
||||
=/ parent=tako:clay i.reverse-ancestors
|
||||
=/ parent-commit .^(yaki:clay %cs /(scot %p our)/base/(scot cas)/yaki/(scot %uv parent))
|
||||
=/ parent-commit .^(yaki:clay %cs /(scot %p our)/[syd]/(scot cas)/yaki/(scot %uv parent))
|
||||
=/ msg (msg-from-commit current-commit tale)
|
||||
:: proper logic is: if there is a mergebase and the current commit is the mergebase, stop. otherwise, continue
|
||||
:: If there is a mergebase and we are visting it right now:
|
||||
:: stop here and clear the mergebase.
|
||||
:: skip adding the mergebase's msg itself because it will be added through the other branch
|
||||
:: Otherwise, record the current message if exists
|
||||
?: ?&(?=(^ mergebase.state) =(u.mergebase.state r.current-commit))
|
||||
:: stop here and clear mergebase. we skip adding the mergebase's msg itself because it will be added through the other branch
|
||||
[result=result.state mergebase=~]
|
||||
commit-loop(current-commit parent-commit, state [?~(msg result.state [u.msg result.state]) mergebase.state])
|
||||
::
|
||||
[tako:clay tako:clay ~]
|
||||
::
|
||||
:: mainline: ultimate base chain
|
||||
:: nextline: relative mainline
|
||||
:: nowline: relative mainline
|
||||
:: sideline: side-chain, featurebranch
|
||||
::
|
||||
:: From the context of e, commit c is on its relative mainline, or nowline, while commit d is on its sideline
|
||||
@ -76,13 +67,12 @@
|
||||
:: %new2 \--d--/ :: sideline
|
||||
::
|
||||
::
|
||||
~& "in merge commit"
|
||||
=/ sideline=tako:clay i.reverse-ancestors
|
||||
=/ mainline=tako:clay i.t.reverse-ancestors
|
||||
=/ mergebases .^((list tako:clay) %cs /(scot %p our)/base/(scot cas)/base-tako/(scot %uv mainline)/(scot %uv sideline))
|
||||
=/ mergebases .^((list tako:clay) %cs /(scot %p our)/[syd]/(scot cas)/base-tako/(scot %uv mainline)/(scot %uv sideline)) :: XX base-tako ignores beak
|
||||
=/ next-mergebase=(unit tako:clay) ?~(mergebases ~ (some i.mergebases)) :: take the first valid mergebase (by convention) if exists, else none
|
||||
=/ sideline-commit=yaki:clay .^(yaki:clay %cs /(scot %p our)/base/(scot cas)/yaki/(scot %uv sideline))
|
||||
=/ mainline-commit=yaki:clay .^(yaki:clay %cs /(scot %p our)/base/(scot cas)/yaki/(scot %uv mainline))
|
||||
=/ sideline-commit=yaki:clay .^(yaki:clay %cs /(scot %p our)/[syd]/(scot cas)/yaki/(scot %uv sideline))
|
||||
=/ mainline-commit=yaki:clay .^(yaki:clay %cs /(scot %p our)/[syd]/(scot cas)/yaki/(scot %uv mainline))
|
||||
=/ msg=(unit cord) (msg-from-commit current-commit tale)
|
||||
::
|
||||
:: 1 - process current commit
|
||||
@ -90,7 +80,7 @@
|
||||
:: 3 - recur and queue processing on all commits on the mainline
|
||||
::
|
||||
:: Because mainline messages are cons'd to result last, they are
|
||||
:: (by definition) towards the less recent side of the (resulting, flopped) list
|
||||
:: (by definition) towards the less recent side of the resulting flopped list
|
||||
::
|
||||
=. state [result=?~(msg result.state [u.msg result.state]) mergebase=next-mergebase] :: 1
|
||||
=. state commit-loop(current-commit sideline-commit) :: 2
|
||||
@ -99,16 +89,26 @@
|
||||
::
|
||||
[tako:clay tako:clay tako:clay *]
|
||||
~& "in 3+ ancestor commit"
|
||||
:: take the first two (sideline/mainline). calculate that mergebase
|
||||
:: recur through sideline (state-b). but instead of state-c line for mainline,
|
||||
=/ sideline=tako:clay i.reverse-ancestors
|
||||
=/ nowline=tako:clay i.t.reverse-ancestors
|
||||
=/ mergebases .^((list tako:clay) %cs /(scot %p our)/base/(scot cas)/base-tako/(scot %uv nowline)/(scot %uv sideline))
|
||||
=/ mergebases .^((list tako:clay) %cs /(scot %p our)/[syd]/(scot cas)/base-tako/(scot %uv nowline)/(scot %uv sideline))
|
||||
=/ next-mergebase=(unit tako:clay) ?~(mergebases ~ (some i.mergebases)) :: take the first valid mergebase (by convention) if exists, else none
|
||||
=/ sideline-commit=yaki:clay .^(yaki:clay %cs /(scot %p our)/base/(scot cas)/yaki/(scot %uv sideline))
|
||||
=/ sideline-commit=yaki:clay .^(yaki:clay %cs /(scot %p our)/[syd]/(scot cas)/yaki/(scot %uv sideline))
|
||||
=. mergebase.state next-mergebase
|
||||
=. state commit-loop(current-commit sideline-commit)
|
||||
=. state ancestor-loop(reverse-ancestors t.reverse-ancestors)
|
||||
=. state commit-loop(current-commit sideline-commit) :: traverse downwards
|
||||
=. state ancestor-loop(reverse-ancestors t.reverse-ancestors) :: traverse rightwards
|
||||
state
|
||||
==
|
||||
++ msg-from-commit
|
||||
|= [commit=yaki:clay tale=story]
|
||||
^- (unit cord)
|
||||
=/ proses (~(get by tale) r.commit)
|
||||
?~ proses ~
|
||||
%- some
|
||||
%- crip
|
||||
;: welp
|
||||
(tako-to-text:lib r.commit)
|
||||
(proses-to-text:lib u.proses)
|
||||
==
|
||||
::
|
||||
--
|
@ -4077,6 +4077,7 @@
|
||||
%+ turn ~(tap in (find-merge-points yaki-a yaki-b))
|
||||
|= =yaki
|
||||
r.yaki
|
||||
::
|
||||
%base
|
||||
?> ?=(^ t.t.pax)
|
||||
:^ ~ ~ %uvs !>
|
||||
|
Loading…
Reference in New Issue
Block a user