From cb46052fc52a1d992057c1d2c67d8dd01fd02a45 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 19 Jul 2009 11:05:32 -0400 Subject: [PATCH] be-handle-mail now commits after every successful email execution. Caveats: It will produce blank commits after emails that make no changes. Todo: --fail-on-null option to "be commit" It will not commit changes due to emails that are partly successful. Todo: add "be revert" --- interfaces/email/interactive/be-handle-mail | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/interfaces/email/interactive/be-handle-mail b/interfaces/email/interactive/be-handle-mail index 1fa9bc2..ecc0752 100755 --- a/interfaces/email/interactive/be-handle-mail +++ b/interfaces/email/interactive/be-handle-mail @@ -24,12 +24,17 @@ email types are differentiated by tags in the email subject. See SUBJECT_TAG* for the current values. Submit emails create a bug (and optionally add some intitial -comments). The post-tag subject is used as the bug summary, -and the email body is parsed for a pseudo-header. Any text -after the psuedo-header but before to allow the submitter y should be of the form +comments). The post-tag subject is used as the bug summary, and the +email body is parsed for a pseudo-header. Any text after the +psuedo-header but before a possible line starting with BREAK is added +as the initial bug comment. +Comment emails... +Control emails... +Any changes made to the repository are commited after the email is +executed, with the email's post-tag subject as the commit message. """ import codecs @@ -64,9 +69,9 @@ NEW_REQUIRED_PSEUDOHEADERS = [u"Version"] NEW_OPTIONAL_PSEUDOHEADERS = [u"Reporter", u"Assign", u"Depend", u"Severity", u"Status", u"Tag", u"Target"] CONTROL_COMMENT = u"#" -ALLOWED_COMMANDS = [u"assign", u"comment", u"depend", u"help", u"list", - u"merge", u"new", u"open", u"severity", u"status", u"tag", - u"target"] +ALLOWED_COMMANDS = [u"assign", u"comment", u"commit", u"depend", u"help", + u"list", u"merge", u"new", u"open", u"severity", u"status", + u"tag", u"target"] libbe.encoding.ENCODING = u"utf-8" # force default encoding ENCODING = libbe.encoding.get_encoding() @@ -380,11 +385,11 @@ class Message (object): otherwise returns a list of suggested commands to run. """ self.validate_subject() + tag,subject = self._split_subject() tag_type,value = self._subject_tag_type() commands = [] if tag_type == u"new": command = u"new" - tag,subject = self._split_subject() summary = subject options = {u"Reporter": self.author_addr()} body,mime_type = list(self._get_bodies_and_mime_types())[0] @@ -433,6 +438,7 @@ class Message (object): raise InvalidEmail(self, u"No commands in control email.") else: raise Exception, u"Unrecognized tag type '%s'" % tag_type + commands.append(Command(self, "commit", [subject])) return commands def run(self): self._begin_response() -- 2.26.2