# # Patch for svnmailer to enable Bugzilla/SVN integration. # --- svnmailer-1.1.0-dev-r1373-orig/src/lib/svnmailer/notifier/_mail.py +++ svnmailer-1.1.0-dev-r1373/src/lib/svnmailer/notifier/_mail.py @@ -285,6 +285,7 @@ :return: The subject line :rtype: ``unicode`` """ + import re from svnmailer import util from svnmailer.settings import MODES @@ -328,6 +329,12 @@ if len(subject) > short_length: subject = dosubject('dirs') + # Use the actual bug id. Don't bother with un/lockings. + if self._settings.runtime.mode.find(MODES.lock) == -1: + if re.search(self._settings.general.bug_tag, self.getLog()): + mo = self._settings.general.bug_tag.search(self.getLog()) + subject = subject.replace("__bug_id__", mo.group(2)) + # reduce to the max ... if max_length and len(subject) > max_length: subject = "%s..." % subject[:max_length - 3] --- svnmailer-1.1.0-dev-r1373-orig/src/lib/svnmailer/notifier/_multimail.py +++ svnmailer-1.1.0-dev-r1373/src/lib/svnmailer/notifier/_multimail.py @@ -155,7 +155,7 @@ :return: The senders, the receivers, the mail(s) :rtype: ``tuple`` """ - import cStringIO + import cStringIO, sys groups = self._groupset.groups sender, to_addrs, headers = self.composeHeaders(groups) @@ -169,6 +169,10 @@ for mail in mails: mail.update(headers) + if self.getMailSubject().find("__bug_id__") != -1: + if self._settings.runtime.debug: + sys.stdout.write("Dropping unprocessed bug mail\n") + continue yield ( sender.encode('utf-8'), [addr.encode('utf-8') for addr in to_addrs], --- svnmailer-1.1.0-dev-r1373-orig/src/lib/svnmailer/notifier/_textmail.py +++ svnmailer-1.1.0-dev-r1373/src/lib/svnmailer/notifier/_textmail.py @@ -124,7 +124,7 @@ :return: The senders, the receivers, the mail(s) :rtype: ``tuple`` """ - import cStringIO + import cStringIO, sys groups = self._groupset.groups sender, to_addrs, headers = self.composeHeaders(groups) @@ -142,6 +142,10 @@ for mail in mails: mail.update(headers) + if self.getMailSubject().find("__bug_id__") != -1: + if self._settings.runtime.debug: + sys.stdout.write("Dropping unprocessed bug mail\n") + continue yield ( sender.encode('utf-8'), [addr.encode('utf-8') for addr in to_addrs], --- svnmailer-1.1.0-dev-r1373-orig/src/lib/svnmailer/settings/__init__.py +++ svnmailer-1.1.0-dev-r1373/src/lib/svnmailer/settings/__init__.py @@ -191,6 +191,7 @@ 'debug_all_mails_to': ('tokenlist', {'map': True}), 'cia_rpc_server' : ('unicode', {'map': True}), 'tempdir' : ('filename', {'map': True}), + 'bug_tag' : ('regex', {'map': True}), # deprecated 'diff_command' : 'unicommand', # no map, because it's treated as