Can I make 'one-shot' mr actions?

John Whitley whitley at bangpath.org
Sun Aug 23 05:04:58 CEST 2015


Evade Flow <evadeflow at gmail.com> wrote:
> This is exactly what I want! I can stuff arbitrary helper commands into a
> 'dummy' repository defined like this:
> 
> [../.repos]
> test = test -e "${MR_REPO}/.e7905c59-c748-4ef2-98b6-0251455ed66c"
> commit = :
> diff = :
> log = :
> push = :
> record = :
> register = :
> status = :
> update = :
> hello = echo "Hello, ${1:-Stranger}!"
> goodbye = echo "Goodbye, ${1:-Stranger}!"
> 
> […] I forked the mr
> repository on github just to apply this trivial patch:

I’ve been thinking about this a bit, and instead of a dummy repo, perhaps there can/should be one or more blessed “magical” repos that support this kind of workflow.  Here’s a straw man to get things going:

If the repo name in .mrconfig is BEGIN, and the command is present in that stanza, then it is run first before all other repos’ commands.  If the repo name in .mrconfig is END, the command is run after all other repos’ commands.

E.g.:

---
[BEGIN]
update = echo “Updating all the things!”
cake = echo “The cake is a ${1:-lie}."

[END]
update = echo “Done updating all the things.”
---

(Astute readers might observe that I’ve been working with awk recently…)

I’m a bit unsure about how to handle the whole “minimal” setting.  I like the idea of being able to extend mr with custom commands and workflows, effectively “global” commands.  But with the current assumption that every repo must support every issued command, the default minimal setting is very noisy.  Perhaps just use a magical “global” repo that encapsulates these workflows, for which minimal is always suppressed:

--- 
[*]  # the “global” repository stanza
hello = echo "Hello, ${1:-Stranger}!"
goodbye = echo "Goodbye, ${1:-Stranger}!"
---

I use ‘*’ vs the word ‘global’ in that last example, as that greatly reduces the chance of collision with a real repo name.

Thoughts?

-- John




More information about the vcs-home mailing list