示例#1
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents.
        """
        # For branch updates, we only send the update email when
        # the summary of changes is needed.
        if not branch_summary_of_changes_needed(self.added_commits,
                                                self.lost_commits):
            return None

        # Compute the subject.
        update_info = {'repo': self.email_info.project_name,
                       'short_ref_name': self.short_ref_name,
                       'branch': '/%s' % self.short_ref_name,
                       'n_commits': '',
                       'subject': commit_subject(self.new_rev)[:59],
                       'old_commit_oneline': commit_oneline(self.old_rev),
                       'commit_oneline': commit_oneline(self.new_rev),
                       }
        if self.short_ref_name == 'master':
            update_info['branch'] = ''
        if len(self.added_commits) > 1:
            update_info['n_commits'] = \
                ' (%d commits)' % len(self.added_commits)

        subject = "[%(repo)s%(branch)s]%(n_commits)s %(subject)s" % update_info

        body = BRANCH_UPDATE_EMAIL_BODY_TEMPLATE % update_info
        body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#2
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        # For branch updates, we only send the update email when
        # the summary of changes is needed.
        if not branch_summary_of_changes_needed(
            self.new_commits_for_ref, self.lost_commits
        ):
            return None

        # Compute the subject.
        update_info = {
            "repo": self.email_info.project_name,
            "short_ref_name": self.short_ref_name,
            "branch": "/%s" % self.short_ref_name,
            "n_commits": "",
            "subject": commit_subject(self.new_rev)[:59],
            "old_commit_oneline": commit_oneline(self.old_rev),
            "commit_oneline": commit_oneline(self.new_rev),
        }
        if self.short_ref_name == "master":
            update_info["branch"] = ""
        if len(self.new_commits_for_ref) > 1:
            update_info["n_commits"] = " (%d commits)" % len(self.new_commits_for_ref)

        subject = "[%(repo)s%(branch)s]%(n_commits)s %(subject)s" % update_info

        body = BRANCH_UPDATE_EMAIL_BODY_TEMPLATE % update_info
        body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#3
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents.
        """
        # For branch updates, we only send the update email when
        # the summary of changes is needed.
        if not branch_summary_of_changes_needed(self.new_commits_for_ref,
                                                self.lost_commits):
            return None

        # Compute the subject.
        update_info = {'repo': self.email_info.project_name,
                       'short_ref_name': self.short_ref_name,
                       'branch': '/%s' % self.short_ref_name,
                       'n_commits': '',
                       'subject': commit_subject(self.new_rev)[:59],
                       'old_commit_oneline': commit_oneline(self.old_rev),
                       'commit_oneline': commit_oneline(self.new_rev),
                       }
        if self.short_ref_name == 'master':
            update_info['branch'] = ''
        if len(self.new_commits_for_ref) > 1:
            update_info['n_commits'] = \
                ' (%d commits)' % len(self.new_commits_for_ref)

        subject = "[%(repo)s%(branch)s]%(n_commits)s %(subject)s" % update_info

        body = BRANCH_UPDATE_EMAIL_BODY_TEMPLATE % update_info
        body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#4
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = '[%s] Updated tag %s' % (self.email_info.project_name,
                                           self.short_ref_name)

        body = (LTAG_UPDATE_EMAIL_BODY_TEMPLATE
                % {'short_ref_name': self.short_ref_name,
                   'commit_oneline': commit_oneline(self.new_rev),
                   'old_commit_oneline': commit_oneline(self.old_rev),
                   })
        if tag_summary_of_changes_needed(self.added_commits,
                                         self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#5
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = '[%s] Updated tag %s' % (self.email_info.project_name,
                                           self.human_readable_tag_name())

        body = (LTAG_UPDATE_EMAIL_BODY_TEMPLATE % {
            'tag_name': self.human_readable_tag_name(),
            'commit_oneline': commit_oneline(self.new_rev),
            'old_commit_oneline': commit_oneline(self.old_rev),
        })
        if tag_summary_of_changes_needed(self.added_commits,
                                         self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#6
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = "[%s] Updated tag %s" % (
            self.email_info.project_name,
            self.human_readable_tag_name(),
        )

        body = LTAG_UPDATE_EMAIL_BODY_TEMPLATE % {
            "tag_name": self.human_readable_tag_name(),
            "commit_oneline": commit_oneline(self.new_rev),
            "old_commit_oneline": commit_oneline(self.old_rev),
        }
        if tag_summary_of_changes_needed(self.new_commits_for_ref, self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#7
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents.
        """
        # For branches, reference names normally start with refs/heads/.
        # If that's not the case, make the branch's namespace explicit.
        if self.ref_namespace in (None, 'refs/heads'):
            in_namespace = ''
        else:
            in_namespace = " in namespace '%s'" % self.ref_namespace

        subject = "[%s] Created branch '%s'%s" % (
            self.email_info.project_name,
            self.short_ref_name,
            in_namespace,
        )

        update_info = {
            'short_ref_name': self.short_ref_name,
            'commit_oneline': commit_oneline(self.new_rev),
            'in_namespace': in_namespace,
        }
        body = BRANCH_CREATION_EMAIL_BODY_TEMPLATE % update_info
        if branch_summary_of_changes_needed(self.added_commits,
                                            self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#8
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = '[%s] Updated tag %s' % (self.email_info.project_name,
                                           self.human_readable_tag_name())

        tag_info = parse_tag_object(self.ref_name)
        # Augment tag_info with some of other elements that will be
        # provided in the mail body.  This is just to make it easier
        # to format the message body...
        tag_info['tag_kind'] = 'signed' if tag_info['signed_p'] else 'unsigned'
        tag_info['tag_name'] = self.human_readable_tag_name()
        tag_info['commit_oneline'] = commit_oneline(self.new_rev)
        tag_info['old_commit_oneline'] = commit_oneline(self.old_rev)

        body = ATAG_UPDATE_EMAIL_BODY_TEMPLATE % tag_info
        if tag_summary_of_changes_needed(self.added_commits,
                                         self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#9
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = '[%s] Updated tag %s' % (self.email_info.project_name,
                                           self.short_ref_name)

        tag_info = parse_tag_object(self.short_ref_name)
        # Augment tag_info with some of other elements that will be
        # provided in the mail body.  This is just to make it easier
        # to format the message body...
        tag_info['tag_kind'] = 'signed' if tag_info['signed_p'] else 'unsigned'
        tag_info['short_ref_name'] = self.short_ref_name
        tag_info['commit_oneline'] = commit_oneline(self.new_rev)
        tag_info['old_commit_oneline'] = commit_oneline(self.old_rev)

        body = ATAG_UPDATE_EMAIL_BODY_TEMPLATE % tag_info
        if tag_summary_of_changes_needed(self.added_commits,
                                         self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#10
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = '[%s] Deleted tag %s' % (self.email_info.project_name,
                                           self.human_readable_tag_name())

        tag_info = {}
        tag_info['tag_name'] = self.human_readable_tag_name()
        tag_info['commit_oneline'] = commit_oneline(self.old_rev)
        body = ATAG_DELETION_EMAIL_BODY_TEMPLATE % tag_info
        if tag_summary_of_changes_needed(self.new_commits_for_ref,
                                         self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#11
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = '[%s] Deleted tag %s' % (self.email_info.project_name,
                                           self.short_ref_name)

        tag_info = {}
        tag_info['short_ref_name'] = self.short_ref_name
        tag_info['commit_oneline'] = commit_oneline(self.old_rev)
        body = ATAG_DELETION_EMAIL_BODY_TEMPLATE % tag_info
        if tag_summary_of_changes_needed(self.added_commits,
                                         self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = '[%s] Deleted tag %s' % (self.email_info.project_name,
                                           self.short_ref_name)

        body = (LTAG_DELETION_EMAIL_BODY_TEMPLATE % {
            'short_ref_name': self.short_ref_name,
            'commit_oneline': commit_oneline(self.old_rev),
        })
        if tag_summary_of_changes_needed(self.added_commits,
                                         self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#13
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents.
        """
        subject = "[%s] Deleted branch %s" % (self.email_info.project_name,
                                              self.short_ref_name)

        update_info = {'short_ref_name': self.short_ref_name,
                       'commit_oneline': commit_oneline(self.old_rev),
                       }
        body = BRANCH_DELETION_EMAIL_BODY_TEMPLATE % update_info
        if branch_summary_of_changes_needed(self.added_commits,
                                            self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#14
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents.
        """
        subject = "[%s] Deleted branch %s" % (self.email_info.project_name,
                                              self.short_ref_name)

        update_info = {
            'short_ref_name': self.short_ref_name,
            'commit_oneline': commit_oneline(self.old_rev),
        }
        body = BRANCH_DELETION_EMAIL_BODY_TEMPLATE % update_info
        if branch_summary_of_changes_needed(self.added_commits,
                                            self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#15
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = "[%s] Deleted branch %s" % (
            self.email_info.project_name,
            self.human_readable_ref_name(),
        )

        update_info = {
            "human_readable_ref_name": self.human_readable_ref_name(),
            "commit_oneline": commit_oneline(self.old_rev),
        }
        body = BRANCH_DELETION_EMAIL_BODY_TEMPLATE % update_info
        if branch_summary_of_changes_needed(self.new_commits_for_ref,
                                            self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#16
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents.
        """
        subject = "[%s] Created branch %s" % (
            self.email_info.project_name, self.human_readable_ref_name())

        update_info = {
            'human_readable_ref_name': self.human_readable_ref_name(
                action='was created'),
            'commit_oneline': commit_oneline(self.new_rev),
            }
        body = BRANCH_CREATION_EMAIL_BODY_TEMPLATE % update_info
        if branch_summary_of_changes_needed(self.new_commits_for_ref,
                                            self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#17
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents."""
        subject = "[%s] Created tag %s" % (
            self.email_info.project_name,
            self.human_readable_tag_name(),
        )

        tag_info = parse_tag_object(self.ref_name)
        # Augment tag_info with some of other elements that will be
        # provided in the mail body.  This is just to make it easier
        # to format the message body...
        tag_info["tag_kind"] = "signed" if tag_info["signed_p"] else "unsigned"
        tag_info["tag_name"] = self.human_readable_tag_name()
        tag_info["commit_oneline"] = commit_oneline(self.new_rev)

        body = ATAG_CREATION_EMAIL_BODY_TEMPLATE % tag_info
        if tag_summary_of_changes_needed(self.new_commits_for_ref,
                                         self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)
示例#18
0
    def get_update_email_contents(self):
        """See AbstractUpdate.get_update_email_contents.
        """
        # For branches, reference names normally start with refs/heads/.
        # If that's not the case, make the branch's namespace explicit.
        if self.ref_namespace in (None, 'refs/heads'):
            in_namespace = ''
        else:
            in_namespace = " in namespace '%s'" % self.ref_namespace

        subject = "[%s] Created branch '%s'%s" % (self.email_info.project_name,
                                                  self.short_ref_name,
                                                  in_namespace,)

        update_info = {'short_ref_name': self.short_ref_name,
                       'commit_oneline': commit_oneline(self.new_rev),
                       'in_namespace': in_namespace,
                       }
        body = BRANCH_CREATION_EMAIL_BODY_TEMPLATE % update_info
        if branch_summary_of_changes_needed(self.added_commits,
                                            self.lost_commits):
            body += self.summary_of_changes()

        return (self.everyone_emails(), subject, body)