mercurial/cmdutil.py
changeset 7879 5c4026a289a4
parent 7878 8c09952cd39a
child 7894 caef5fdf1375
--- a/mercurial/cmdutil.py	Mon Mar 23 13:15:57 2009 +0100
+++ b/mercurial/cmdutil.py	Mon Mar 23 10:41:42 2009 +0100
@@ -830,6 +830,15 @@
                              node=hex(ctx.changeset()[0])))
             return self.t('manifest', **args)
 
+        def showdiffstat(**args):
+            diff = patch.diff(self.repo, ctx.parents()[0].node(), ctx.node())
+            files, adds, removes = 0, 0, 0
+            for i in patch.diffstatdata(util.iterlines(diff)):
+                files += 1
+                adds += i[1]
+                removes += i[2]
+            return '%s: +%s/-%s' % (files, adds, removes)
+
         defprops = {
             'author': ctx.user(),
             'branches': showbranches,
@@ -846,6 +855,7 @@
             'rev': ctx.rev(),
             'tags': showtags,
             'extras': showextras,
+            'diffstat': showdiffstat,
             }
         props = props.copy()
         props.update(defprops)