# HG changeset patch # User divy@chelsio.com # Date 2008-09-02 23:49:16 # Node ID a3fd4aa154afff901779639df0963e4e2848b7dd # Parent 2ca84555ba1f0b6e822dfce5810b480b9e449fb5 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. diff --git a/hgext/notify.py b/hgext/notify.py --- a/hgext/notify.py +++ b/hgext/notify.py @@ -233,9 +233,11 @@ class notifier(object): 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 @@ class notifier(object): 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.