Mercurial > hg
changeset 6979:a3fd4aa154af
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.
author | divy@chelsio.com |
---|---|
date | Wed, 03 Sep 2008 01:49:16 +0200 |
parents | 2ca84555ba1f |
children | 2268edff1bec |
files | hgext/notify.py |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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.