threads / discuss / 4615

Added macro support to qgit

Subject: Added macro support to qgit

## tl;dr

4 messages between Jun 22, 2006 and Jun 23, 2006.

replies: 3people: 2as markdown or json

Marco Costalba· Jun 22, 2006, 14:04 UTC · lore
I have pushed some patches that add macros to qgit.
>From menu bar it is possible to  run a macro created by a fancy new
dialog invoked by 'Macros->Setup macros...' menu.
See http://digilander.libero.it/mcostalba/macros_menu.png
        http://digilander.libero.it/mcostalba/macros_dialog.png

A macro can be associated to a any sequence of commands or to an external script.

In case of commands sequence, these will be wrapped up in a temporary script and executed as a whole.

A macro can also ask for command line arguments before to be run so to allow for maximum flexibility. In case of multi commands sequence given command line arguments will be bounded to first one only.

While a macro is running a terminal window is shown to display the corresponding output.

qgit repository is: git://git.kernel.org/pub/scm/qgit/qgit.git
Comments and feedback are welcomed.
     Marco
Pavel Roskin· Jun 23, 2006, 01:00 UTC · re: Marco Costalba · lore

Re: Added macro support to qgit

Hello, Marco!
On Thu, 2006-06-22 at 16:04 +0200, Marco Costalba wrote:
> I have pushed some patches that add macros to qgit.
> 
> From menu bar it is possible to  run a macro created by a fancy new
> dialog invoked by 'Macros->Setup macros...' menu.

I'm not sure they can be called macros. Macro is something consisting of several commands that are already implemented. So, a macro-assembler is a program that allows to combine several supported instructions into one macro. Macros in editors record actions already implemented by the editors. You may also want to read this: http://en.wikipedia.org/wiki/Macro

If I understand correctly, qgit doesn't do that. It calls external commands that are not implemented internally, and it doesn't aggregate anything. Then why not call them "external commands"?

The interface is quite confusing. I see 5 buttons on top, all of which are enabled, plus one button labeled as "...", three checkboxes, one single-line entry and one multiline entry. I have no I idea where to start. Should I click "new" or white something and then click "new"? And where's "Cancel"?.

That's what I have tried:

Enter "foo bar" in the multiline entry. Click "New" Enter "foobar" Click "New" Enter "abc" Select "foobar"

Now "Run external script" is selected and "foo bar" is gone! I believe user input should not be discarded without a warning.

I also tried something more meaningful. I create a "pull" macro as an external script "stg pull". It didn't work. Am I supposed to supply full path? Does it understand arguments? It the script supposed to be in a certain format? OK, stg is written in python, but how about cg-status, a shell script? It doesn't seen to work either.

I could make macros work when I entered the under "Insert commands to run". The output window looks nice. But I see no indication whether the script is running or it has finished. I don't see how to terminate the script "gently", an equivalent of Ctrl-C.

As far as I understand, the text entries should not be enabled at the same time. But it saw it happening when there were no macros at all. And if I delete all macros, "Insert commands to run" doesn't work at all.

What happens to the arguments qgit is asking for if a multiline entry is executed? I understand they are prepended to the first line. This is not quite logical. Wouldn't it be better to have a shell like notation for them?

I see the macros are saved in the qgit configuration for the user .qt/qgitrc, like this:

[Macro reset] commands=echo\nstg pull\necho 123\nsleep 5 patch_flags=9040 script_path=/home/proski/bin/cg-reset

Shouldn't only one of commands and script_path be saved? Whouldn't it be better to save meaningful boolean options instead of the opaque binary "patch_flags"

And what is "macro_name=New macro" in [General]?

I think I should write you what I would like to see in qgit, but that would be a separate e-mail.

-- 
Regards,
Pavel Roskin
Marco Costalba· Jun 23, 2006, 17:44 UTC · re: Pavel Roskin · lore

Re: Added macro support to qgit

Hi Pavel,
> If I understand correctly, qgit doesn't do that.  It calls external
> commands that are not implemented internally, and it doesn't aggregate
> anything.  Then why not call them "external commands"?
>
Or just "commands"? in any case I agree "macro" was not a good choice.
Show 18 quoted lines
> The interface is quite confusing.  I see 5 buttons on top, all of which
> are enabled, plus one button labeled as "...", three checkboxes, one
> single-line entry and one multiline entry.  I have no I idea where to
> start.  Should I click "new" or white something and then click "new"?
> And where's "Cancel"?.
>
> That's what I have tried:
>
> Enter "foo bar" in the multiline entry.
> Click "New"
> Enter "foobar"
> Click "New"
> Enter "abc"
> Select "foobar"
>
> Now "Run external script" is selected and "foo bar" is gone!  I believe
> user input should not be discarded without a warning.
>

The bug is qgit lets you write the first foo bar, before you press NEW button. It shouldn't. Also some buttons enable/disable policy could be good.

Show 6 quoted lines
> I also tried something more meaningful.  I create a "pull" macro as an
> external script "stg pull".  It didn't work.  Am I supposed to supply
> full path?  Does it understand arguments?  It the script supposed to be
> in a certain format?  OK, stg is written in python, but how about
> cg-status, a shell script?  It doesn't seen to work either.
>

You are not supposed to supply full path, any executable file should be OK and yes, you could supply arguments. You don't see nothing because of a silly bug.

Show 5 quoted lines
> What happens to the arguments qgit is asking for if a multiline entry is
> executed?  I understand they are prepended to the first line.  This is
> not quite logical.  Wouldn't it be better to have a shell like notation
> for them?
>

I thought of commands sequence as a quick way to run some simple commands as git pull, git push or similar without writing a bash script, i.e. no $1 for arguments. If you need something more complex the external script is supposed to be the proper way.

Perhaps we could remove the external script single edit line and use only the multiline edit to let user insert commands or script.

> I see the macros are saved in the qgit configuration for the
> user .qt/qgitrc, like this:
>

Well, this file is really not meant to be view nor to be modified by hand, it is mainly a qgit 'private' thing stuff. Being qgit a GUI tool with a (nice ;-) ) settings dialog, configuration file is mainly used for persistency, not for browsing/setup.

I hope to fix the external commands interface bugs this week-end.

Thanks for your reports Marco

Pavel Roskin· Jun 23, 2006, 20:15 UTC · re: Marco Costalba · lore

Re: Added macro support to qgit

On Fri, 2006-06-23 at 19:44 +0200, Marco Costalba wrote:
> Or just "commands"? in any case I agree "macro" was not a good choice.

For a menubar entry, something short is preferred, so "Commands" or "Actions" would be better than "external commands". Emacs calls it "Tools". But for a menu entry and the dialog title, "external commands" would be better.

> The bug is qgit lets you write the first foo bar, before you press NEW
> button. It shouldn't. Also some buttons enable/disable policy could be
> good.
Definitely.
> > What happens to the arguments qgit is asking for if a multiline entry is
> > executed?  I understand they are prepended to the first line.  This is
> > not quite logical.  Wouldn't it be better to have a shell like notation
> > for them?
I meant appended, sorry.
> I thought of commands sequence as a quick way to run some simple
> commands as git pull, git push or similar without writing a bash
> script, i.e. no $1 for arguments. If you need something more complex
> the external script is supposed to be the proper way.

I think the checkbox controlling whether to ask for arguments allows selection between "simple" and "complex" commands.

> Perhaps we could remove the external script single edit line and use
> only the multiline edit to let user insert commands or script.
I agree.
> > I see the macros are saved in the qgit configuration for the
> > user .qt/qgitrc, like this:
> Well, this file is really not meant to be view nor to be modified by
> hand, it is mainly a qgit 'private' thing stuff. Being qgit a GUI tool
> with a (nice ;-)  ) settings dialog, configuration file is mainly used
> for persistency, not for browsing/setup.
OK
> I hope to fix the external commands interface bugs this week-end.
I'm looking forward to testing it.
-- 
Regards,
Pavel Roskin

← back to recent threads