[RFC] use optparse for option handling

Aaron Bentley aaron.bentley at utoronto.ca
Wed Jul 12 19:52:35 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's a bundle that uses optparse as a backend.

This gets us out of the option-parsing business, and it also clears the
way for using advanced optparse features.

We need enumerations-- that is, flags that set the same variable to
different values.  Log formats and merge types should be handled that
way.  It might also be nice to have -v increase the verbosity level.

I really like our frontend-- I find it much nicer to use than doing
optparse directly.  (Bugs Everywhere does that, and it's a PITA.  I
guess optparse is fine if you don't have lots of subcommands.)

There is one behaviour change: it's now legal to specify the same option
multiple times (the last value is used).

Optparse wants to determine the 'final value' of options by filling in
defaults, but we want to let command defaults determine that, so we use
a unique default value, and filter out options assigned to that value.

(btw, is there a way to prevent that string from being interned?  I
don't want false negatives from
"if v is not OptionParser.DEFAULT_VALUE")

There are no new tests, though the existing blackbox tests provide
pretty good coverage.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEtUTz0F+nu1YWqI0RAjyBAJ9cyMvnRkosCyuAAM7i1YFZurjFSgCgh2G2
ImM8HOrHbZ+HfTgUYqhIyLo=
=s8di
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: optparse.patch
Type: text/x-patch
Size: 8846 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060712/69d29aa7/attachment.bin 


More information about the bazaar mailing list