# HG changeset patch # User divy@chelsio.com # Date 1220399356 -7200 # 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 -r 2ca84555ba1f -r a3fd4aa154af 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.