Can I make 'one-shot' mr actions?

Evade Flow evadeflow at gmail.com
Sun Aug 23 19:19:56 CEST 2015


I really like the idea of a [*] section for global commands that have
--minimal set to true by default. If possible, it would be ideal if mr
wouldn't even *try *to run these helper commands against 'real'
repositories, since some of the commands may delete (or move) repository
folders. I'm seeing this now with my attempts to implement mr hide and mr
unhide:

% mr hide rtt-event-server replay-fix
mr hide: /home/acme/projects/rtt/../.repos
Moving /home/acme/projects/rtt/../.repos/rtt-event-server to
.stash/rtt-event-server.replay-fix... DONE.

mr hide: failed to chdir to
/home/acme/projects/rtt/../.repos/rtt-event-server/: No such file or
directory

Haven't figured out yet why it's trying to chdir to the folder again after
the hide command moves it, but I assume it's to something to do with post
actions(?) Puzzling through that now.

I don't yet have a use case for [BEGIN] and [END] sections, but I can see
how they might be helpful for CI-type tasks, where you want to have a hook
to notify a Slack or HipChat channel that a set of operations has
started/finished.  Wondering whether [PRE] and [POST] might be better
names. (Might communicate the concept of 'globla pre-' and 'global post-'
actions a bit better because it's suggestive of the already-existing
pre_<action> and post_<action> syntax?)

On Sat, Aug 22, 2015 at 11:04 PM, John Whitley <whitley at bangpath.org> wrote:

> 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
>
>
> _______________________________________________
> vcs-home mailing list
> vcs-home at lists.madduck.net
> http://lists.madduck.net/listinfo/vcs-home


More information about the vcs-home mailing list