FEATURE REQ: Make alias for --diff-options

John A Meinel john at arbash-meinel.com
Tue Sep 13 13:06:04 BST 2005


Jari Aalto wrote:
> I find it quite demanding to have to type the extra options
> to diff:
>
>    $ bzr diff --diff-options -bwu -C 5
>
> This is all good for scripts where GNU --long option names are
> designed to be used, but for command line use the short forms are
> needed. Would it be possible to provide shorted form for command line
> use, something like:
>
>    $ bzr diff -o -bwu -C 5
>               |
>               extra options to diff follow
>
>
> Jari
>

As I may have mentioned. One problem is that the short options are
consistent across all commands. So while "-o" makes the most sense to
diff as "--diff-options", it might make more sense as "--output" for
something else. As the interface settles down, I think we'll see more
short options form.

In the mean-time, might I recommend this plugin:

import bzrlib, bzrlib.builtins

class cmd_mydiff(bzrlib.builtins.cmd_diff):
  def run(self, *args, **kwargs):
    kwargs['diff_options'] = '-bwu -C 5'
    super(cmd_mydiff, self).run(*args, **kwargs)

bzrlib.commands.register_command(cmd_mydiff)

Save the above snippet to ~/.bzr.conf/plugins/somefile.py

And then it should be automatically loaded by bzr and allow you to type:

bzr mydiff

Which should set up all the options that you care about. If you *always*
want to use it, you can even name the function "cmd_diff", the namespace
prevents it from being confused, and then just a plain "bzr diff" will
run with your custom options. (If you do overload "bzr diff", then you
can run "bzr --no-plugins diff", or "bzr --builtins diff" to get the
original function).

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050913/0c1adc3d/attachment.pgp 


More information about the bazaar mailing list