I attach a patch which should improve the notifications. Here is an example of the new output.
https://www.irccloud.com/pastebin/HdlVbQt4/ Matt On Tue, Jan 19, 2016 at 11:29 AM, Matthew Pickering <[email protected]> wrote: > Have you had any chance to think about this yet Herbert? > > Matt > > On Wed, Jan 6, 2016 at 6:44 PM, Ben Gamari <[email protected]> wrote: >> Ben Gamari <[email protected]> writes: >> >>> Matthew Pickering <[email protected]> writes: >>> >>>> I subscribe to the ghc-tickets[1] mailing list which provides updates >>>> to all trac tickets. This is very useful, however when a ticket >>>> description is updated the whole description is included in the email >>>> which makes it hard to see what actually changed. The web interface >>>> shows a nice diff[2] of the changes, I think it would be good if >>>> emails could also include a diff rather than the current quite useless >>>> output. >>>> >>> I think this would be a great improvement. I, for one, am quite guilty >>> of incrementally editing ticket descriptions and the current email >>> notifications are nearly useless in this case. >>> >>>> After a bit of investigation, it appears that the easiest way to >>>> achieve this is apply a simple patch to our copy of trac. The current >>>> format is hard coded on line 558 in this module, it seems easy to >>>> modify this section to instead provide a diff. >>>> >>> Herbert, perhaps we could do something along these lines? >>> >> Ping. >> >> Cheers, >> >> - Ben
From 66cc688282b437266682f3dec211e84efc331721 Mon Sep 17 00:00:00 2001 From: Matthew Pickering <[email protected]> Date: Wed, 20 Jan 2016 14:09:14 +0100 Subject: [PATCH] Add delta to ticket modification notification Instead of the previously useless notification which displayed both the new and old description. We now display the delta and the new description. --- trac/ticket/notification.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/trac/ticket/notification.py b/trac/ticket/notification.py index 8d7e963..7d6598e 100644 --- a/trac/ticket/notification.py +++ b/trac/ticket/notification.py @@ -40,6 +40,7 @@ from trac.util.text import exception_to_unicode, obfuscate_email_address, \ shorten_line, text_width, wrap from trac.util.translation import _, deactivate, reactivate from trac.web.chrome import Chrome +from trac.versioncontrol.diff import unified_diff class TicketNotificationSystem(Component): @@ -557,14 +558,13 @@ class TicketNotifyEmail(NotifyEmail): if field == 'description': new_descr = wrap(new, self.COLS, ' ', ' ', '\n', self.ambiwidth) - old_descr = wrap(old, self.COLS, '> ', '> ', '\n', + + old_descr = wrap(old, self.COLS, ' ', ' ', '\n', self.ambiwidth) - old_descr = old_descr.replace(2 * '\n', '\n' + '>' + - '\n') + diff = unified_diff(old_descr.split('\n'), new_descr.split('\n'), context=0) cdescr = '\n' - cdescr += 'Old description:' + 2 * '\n' + old_descr + \ - 2 * '\n' - cdescr += 'New description:' + 2 * '\n' + new_descr + \ + cdescr += '\n'.join(diff) + cdescr += '\n\nNew description:' + 2 * '\n' + new_descr + \ '\n' changes_descr = cdescr elif field == 'summary': -- 2.1.4
_______________________________________________ ghc-devs mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
