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)
Exemple #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)
Exemple #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)
Exemple #4
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)
    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)
    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)
Exemple #7
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)
Exemple #8
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)
    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)