notify: fix diffstat printing
authordivy@chelsio.com
Wed, 03 Sep 2008 01:49:16 +0200
changeset 6979 a3fd4aa154af
parent 6978 2ca84555ba1f
child 6980 2268edff1bec
notify: fix diffstat printing notify.diff() keeps line breaks in the diff buffer before calling patch.diffstat(). patch.diffstat() however adds another line break when feeding diffstat input. The added extra empty line leads to erroneous diffstat output. This fix removes the line breaks in notify.diff() and adds it back to print them.
hgext/notify.py
--- a/hgext/notify.py	Wed Sep 03 01:29:03 2008 +0200
+++ b/hgext/notify.py	Wed Sep 03 01:49:16 2008 +0200
@@ -233,9 +233,11 @@
     def diff(self, node, ref):
         maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
         prev = self.repo.changelog.parents(node)[0]
+
         self.ui.pushbuffer()
         patch.diff(self.repo, prev, ref, opts=patch.diffopts(self.ui))
-        difflines = self.ui.popbuffer().splitlines(1)
+        difflines = self.ui.popbuffer().splitlines()
+
         if self.ui.configbool('notify', 'diffstat', True):
             s = patch.diffstat(difflines)
             # s may be nil, don't include the header if it is
@@ -249,7 +251,7 @@
             difflines = difflines[:maxdiff]
         elif difflines:
             self.ui.write(_('\ndiffs (%d lines):\n\n') % len(difflines))
-        self.ui.write(*difflines)
+        self.ui.write("\n".join(difflines))
 
 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
     '''send email notifications to interested subscribers.