[darcs-users] Proposal: add 'darcs do' command

Ben Franksen benjamin.franksen at bessy.de
Tue Apr 5 16:38:29 UTC 2011

Hi Darcsers

when a few versions ago 'darcs changes' aquired the --interactive switch I 
immediately put 'changes interactive' in my ~/.darcs/default, so now I say 
just 'darcs changes' to view the last few patches. It now happened to me for 
the n-th time that I wished I could select another darcs command to be 
performed for the patch currently under consideration by 'darcs changes'.

For instance, suppose I am viewing the 5-th last patch when I notice that I 
made a typo in the patch name. What I'd like to do is say "Right here, amend 
this patch" (I have 'amend-record edit-long-description' in my 
~/.darcs/default, too). Or I am curious whether I have already pushed this 
patch to the default repo, so I want to 'darcs push --dry-run' this patch, 
or maybe even really 'darcs push' it.

As it is, I must say 'q', then move my hand to the mouse to select the patch 
name (or part of it), then say

  darcs whatever -p''<left arrow>
  hit middle mouse button

etc and afterwards repeat 'darcs changes' and hit 5 times 'n' to be at the 
same place I was before.

Now, I realize that it would maybe not be such a good idea to have 'darcs 
changes' do something other than showing changes. But... what about a new 
command for the same purpose?

So here is my strawman proposal: I'd like to have a new command named 'do'. 
When I say 'darcs do', it first behaves like 'darcs changes -i'. However, it 
offers *one* additional key-press-triggered action: when you hit 'e', it 
switches to "darcs command mode", where I get a different selection of keys 
to chose from, one where each key corresponds to a darcs command (and one to 
return to the "darcs changes" mode). If I chose a command, then the effect 
is the same as if I had done

  darcs <command> --matches='exact <patch-name>'

where <command> is the name of the command you selected and <patch-name> is 
the name of the patch under consideration.

I think this would be an extremely convenient feature. I am almost tempted 
to checkout the darcs repo and start hacking on this.

What do you think?


More information about the darcs-users mailing list