[PATCH] Re: [new] diffstat plugin
Wouter Bolsterlee
uws at xs4all.nl
Thu Dec 1 16:38:54 GMT 2005
På Thu, Dec 01, 2005 at 05:16:40PM +0100, Wouter Bolsterlee skrev:
> P? Tue, Nov 29, 2005 at 06:21:47PM -0600, Michael Ellerman skrev:
> > On Tue, 29 Nov 2005 17:37, Wouter Bolsterlee wrote:
> > > P? Tue, Nov 29, 2005 at 05:10:01PM -0600, Michael Ellerman skrev:
> > > > On Tue, 29 Nov 2005 16:20, Wouter Bolsterlee wrote:
> > > > > + aliases = ['ds']
> > > > I thought about that, but I thought it was perhaps a bit too short - and
> > > > I didn't want to create a potential problem if there's something else in
> > > > the future that should get 'ds'.
> > > On the other hand, if someone uses this plugin it's quite likely they use
> > > the diffstat command a lot. Otherwise you can just type `bzr di |diffstat`
> > > if you have to.
> > > I'm still in favor of the alias :)
> > Ok you've convinced me, pull it again and you'll get the alias and a few other
> > changes.
>
> It doesn't accept revision parameters: bzr ds -r5..8 fails.
...but after some minor hacking it does:
=== modified file '__init__.py'
--- __init__.py
+++ __init__.py
@@ -6,8 +6,9 @@
class cmd_diffstat(bzrlib.commands.Command):
"""diffstat - show stats about changes to the working tree"""
takes_args = ['file*']
+ takes_options = ['revision']
aliases = ['ds']
- def run(self, file_list=None):
+ def run(self, revision=None, file_list=None):
from diffstat import DiffStat
from bzrlib.branch import Branch
from StringIO import StringIO
@@ -21,7 +22,16 @@
b = Branch.open_containing(location)[0]
out = StringIO()
- show_diff(b, None, specific_files=file_list, output=out)
+
+ if not revision:
+ show_diff(b, None, specific_files=file_list, output=out)
+ elif len(revision) == 1:
+ show_diff(b, revision[0], specific_files=file_list,
+ output=out)
+ elif len(revision) == 2:
+ show_diff(b, revision[0], specific_files=file_list,
+ output=out, revision2=revision[1])
+
out.seek(0)
ds = str(DiffStat(out.readlines()))
if len(ds):
Please patch!
mvrgr, Wouter Bolsterlee
--
:wq mail uws at xs4all.nl
web http://uwstopia.nl
you keep me alone :: in a room full of friends -- porcupine tree
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051201/7f54a33e/attachment.pgp
More information about the bazaar
mailing list