[MERGE] command defaults

Aaron Bentley aaron.bentley at utoronto.ca
Wed Feb 1 18:40:44 GMT 2006


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

Hi all,
I've implemented per-user command defaults, in what I hope is a fairly
tasteful way.

In ~/.bazaar/bazzar.conf, you can now have a COMMAND_DEFAULTS section.
If you do, the 'name' is the command name, and the 'value' is a set of
options and arguments.  As in all config files, # can be used to supply
a comment.

Example:
[COMMAND_DEFAULTS]
commit = --strict # doncha hate it when you forget to add a file?
revert = --no-backup
log = --short -r -1..-5
merge = --reprocess

When an option is supplied on the commandline that is also supplied in
the defaults, the default for that value is ignored.  For example:
$bzr log -r -1..-10
would combine with the above defaults to produce, effectively:
$ bzr log --short -r -1..-10

Additionally, a --no-defaults global option is available to prevent any
defaults from being used.  (Especially for scripts and the test suite.)

Branch:
http://panoramicfeedback.com/opensource/bzr/bzr.ab/

Patch attached.

Areas for future improvement:
1. the test suite should supply a default home directory
2. argument parsing should support enumerations: that is,
log --short, --long and --line are all really different values for the
same option.  In the ideal, we'd have something like
OptionEnum('log-format', 'short', 'long', 'line').  The user could
specify 'log --line', this would be parsed to {'log-format', 'line'},
and it would override a default of log=--short

The same approach would apply to merge-type.

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

iD8DBQFD4QCs0F+nu1YWqI0RAqNSAJ41f2rm/g9ROsV8mjO9n6Y7h4+gqQCdHn8E
DVb4/Pe6xOQDYcv3vVr8XSM=
=AftU
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: command-defaults.patch
Type: text/x-patch
Size: 6496 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060201/958e2a4d/attachment.bin 


More information about the bazaar mailing list