[ANN][PLUGIN] graphical diff using kompare
John Arbash Meinel
john at arbash-meinel.com
Wed Apr 26 15:07:49 BST 2006
Stephen Ward wrote:
> On Wednesday 26 April 2006 01:21, Martin Pool wrote:
>> This looks nice. I agree it would be good to unify the various
>> external diff/merge things - there may need to be some per-tool
>> intelligence about whether it can do tree diffs, etc.
>
> Agreed.
>
> Is there any way for a plugin to add a new option to an existing command,
> rather than adding a new command? For example:
>
> bzr diff --using kdiff3 [OPTIONS] [FILES*]
>
> Or would that have to be done with a patch to bzrlib itself?
You can register a command with the same name as a builtin. And bzr will
preferentially use the plugin command.
My best recommendation is to just do it as a wrapper. Something like:
from bzrlib.commands import register_command
from bzrlib.option import Option
import bzrlib.builtins
class cmd_diff(bzrlib.builtins.cmd_diff):
takes_args.append(Option('using', type=str,
help='set the diff algorithm'))
def run(self, *args, **kwargs):
if 'using' in kwargs:
# Run the custom algorithm
else:
# Run the standard algorithm
return super(cmd_diff, self).run(*args, **kwargs)
>
>> When I run this for a whole-tree diff, it shows diffs within .bzr as
>> well. I can add that to the ignore list but is there any way the
>> plugin can arrange for it to be automatically hidden?
>
> I'm sure that this could be done, but the ignore-list mechanisms are extremely
> tool-specific (and in most cases, not designed for use from the command
> line), so there would be a fair amount of code involved. I'm generally
> reluctant to go messing with other application's config files.
>
> For the moment, I've just settled for mentioning the need for this sort of
> tool-specific configuration in the help text and the README.
>
> -- Steve
>
Well, if you could pass something like that as a command-line option, it
would be nice to pass it for algorithms that are known. I agree that we
shouldn't change the user settings, though.
What do you use as a basis tree for stuff inside .bzr?
I'm fairly curious how you get the whole tree diff for kompare, since it
would involve extracting each file.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060426/4fb2d954/attachment.pgp
More information about the bazaar
mailing list