Proposal: separate script interface

John A Meinel john at arbash-meinel.com
Fri Jun 10 16:24:14 BST 2005


Aaron Bentley wrote:
> Hi all,
> 
> I'd like to propose that we provide a separate interface for scripting,
> instead of trying to support scripting with the same UI that we offer to
>  commandline users.

I would make a few small points

1) For now, bzrlib *is* the scripting interface. It has all the
functionality and everything exposed. It doesn't work quite as well for
shell scripting, but it works great for python scripting.

2) I vote for having a separate front-end. I'm also concerned about the
difficulties in maintaining 2 code paths. The way the front end is
written right now, there are a limited number of possible option flags,
which are designed to work across all commands. This makes it tricky to
add support for the myriad necessary to tightly define the rest of the
front-ends.

3) Creating a "bzr script foo" isn't very difficult. See revision 658,
where my external plugin code has been merged, and provides "bzr builtin
foo" for disabling plugins. "bzr script foo" could just set a flag which
enables all of the scripting options.

Maybe bzr script foo isn't so bad. We could update the parse routines so
that you would have:

class cmd_commit(Command):
	takes_args = ['selected*']
	takes_options = ['message', 'file', 'verbose']
	takes_script_options = ['committer', 'author']

And parse_args would only parse the "script_options" if bzr script was
specified.

I certainly prefer having bzr script set a flag that changes argument
parsing, rather than writing a different cmd_commit() (one for
scripting, one without) because that introduces multiple code paths.

Actually, the flag could also be set by using the:
if sys.argv[0] == 'bzrscript' test

...

> One way to do this would be to introduce a "script" command, which had
> its own set of subcommands.  So you might do
> 
> "bzr script commit --uuid asd;lghas;ldi --committer 'Martin Pool
> <mpool at bazaar-ng.org> --author 'Aaron Bentley
> <aaron.bentley at utoronto.ca>' -m 'Added Aaron's patch'"
> 
> You could have a --script option instead, but I don't think that would
> be as clear.  Another option would be to use a separate comand name for
> the scripting interface, like 'bzrscript' instead of 'bzr'.
> 
> Aaron

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050610/63e025fd/attachment.pgp 


More information about the bazaar mailing list