diffs with a *prepended diffstat*

Robert Widhopf-Fenk hack at robf.de
Fri Jun 9 22:13:00 BST 2006


On Thursday, June 8, 2006 at 13:51:15, Michael Ellerman wrote:
> On 6/8/06, John Arbash Meinel <john at arbash-meinel.com> wrote:
> > Robert Widhopf-Fenk wrote:
> > > Patches/diffs from Martin and others have the output of
> > > diffstat prepended.
> > >
> > > Is there a single command, plugin or option to create these
> > > nice diffs with a *prepended diffstat* or did I miss something?
> > >
> > > Robert
> > >
> > >
> >
> > I'm pretty sure they just generate the diff, and then call
> > diffstat on it.
> >
> > There was a 'bzr diffstat' plugin, but I don't think it generated
> > both the diffstat and the diff.
> 
> The diffstat plugin is here:
> http://michael.ellerman.id.au/bzr/plugins/diffstat
> 
> To get a diffstat & diff, just run "bzr diffstat ; bzr diff"

 (bzr diffstat ; bzr diff) > the.diff

is not as fast and short as

 bzr diffstat -v > the.diff

enabled by the simple patch below.  Maybe it is even faster
to join the line and print them instead of iterating the
list, but that must be answered by an Python guru.

Robert

-------------- next part --------------
 __init__.py	2006-05-08 13:52:49 +0000 | 8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
=== modified file '__init__.py'
--- __init__.py	2006-05-08 13:52:49 +0000
+++ __init__.py	2006-06-09 21:11:24 +0000
@@ -2,13 +2,14 @@
 """diffstat - show stats about changes to the working tree"""
 
 import bzrlib.commands
+import sys
 
 class cmd_diffstat(bzrlib.commands.Command):
     """diffstat - show stats about changes to the working tree"""
     takes_args = ['file*']
-    takes_options = ['revision']
+    takes_options = ['revision','verbose']
     aliases = ['ds']
-    def run(self, revision=None, file_list=None):
+    def run(self, revision=None, file_list=None, verbose=False):
         from diffstat import DiffStat
         from bzrlib.bzrdir import BzrDir
 
@@ -29,6 +30,9 @@
         ds = str(DiffStat(diff))
         if len(ds):
             print ds
+	    if verbose:
+		for l in diff:
+		    sys.stdout.write(l)
         return 0
 
     def __diff(self, bzrdir, revision, file_list):



More information about the bazaar mailing list