def run(self, state):
        self._commit_message = self._tool.checkout().commit_message_for_this_commit(self._options.git_commit).message()
        if len(self._commit_message) < 50:
            raise Exception("Attempted to commit with a commit message shorter than 50 characters.  Either your patch is missing a ChangeLog or webkit-patch may have a bug.")

        self._state = state

        username = None
        force_squash = False

        num_tries = 0
        while num_tries < 3:
            num_tries += 1

            try:
                scm = self._tool.scm()
                commit_text = scm.commit_with_message(self._commit_message, git_commit=self._options.git_commit, username=username, force_squash=force_squash)
                svn_revision = scm.svn_revision_from_commit_text(commit_text)
                log("Committed r%s: <%s>" % (svn_revision, view_source_url(svn_revision)))
                self._state["commit_text"] = commit_text
                break;
            except AmbiguousCommitError, e:
                if self._tool.user.confirm(self._commit_warning(e)):
                    force_squash = True
                else:
                    # This will correctly interrupt the rest of the commit process.
                    raise ScriptError(message="Did not commit")
            except AuthenticationError, e:
                username = self._tool.user.prompt("%s login: "******"You need to specify the username on %s to perform the commit as." % self.svn_server_host)
    def _prepare_state(self, options, args, tool):
        state = AbstractRolloutPrepCommand._prepare_state(self, options, args, tool)
        # Currently, state["bug_id"] points to the bug that caused the
        # regression.  We want to create a new bug that blocks the old bug
        # so we move state["bug_id"] to state["bug_blocked"] and delete the
        # old state["bug_id"] so that steps.CreateBug will actually create
        # the new bug that we want (and subsequently store its bug id into
        # state["bug_id"])
        state["bug_blocked"] = state["bug_id"]
        del state["bug_id"]
        state["bug_title"] = "REGRESSION(r%s): %s" % (state["revision"], state["reason"])
        state["bug_description"] = "%s broke the build:\n%s" % (view_source_url(state["revision"]), state["reason"])
        # FIXME: If we had more context here, we could link to other open bugs
        #        that mention the test that regressed.
        if options.parent_command == "sheriff-bot":
            state["bug_description"] += """

This is an automatic bug report generated by the sheriff-bot. If this bug
report was created because of a flaky test, please file a bug for the flaky
test (if we don't already have one on file) and dup this bug against that bug
so that we can track how often these flaky tests case pain.

"Only you can prevent forest fires." -- Smokey the Bear
"""
        return state
Example #3
0
    def _prepare_state(self, options, args, tool):
        state = AbstractRolloutPrepCommand._prepare_state(self, options, args, tool)
        # Currently, state["bug_id"] points to the bug that caused the
        # regression.  We want to create a new bug that blocks the old bug
        # so we move state["bug_id"] to state["bug_blocked"] and delete the
        # old state["bug_id"] so that steps.CreateBug will actually create
        # the new bug that we want (and subsequently store its bug id into
        # state["bug_id"])
        state["bug_blocked"] = state["bug_id"]
        del state["bug_id"]
        state["bug_title"] = "REGRESSION(r%s): %s" % (state["revision"], state["reason"])
        state["bug_description"] = "%s broke the build:\n%s" % (view_source_url(state["revision"]), state["reason"])
        # FIXME: If we had more context here, we could link to other open bugs
        #        that mention the test that regressed.
        if options.parent_command == "sheriff-bot":
            state["bug_description"] += """

This is an automatic bug report generated by the sheriff-bot. If this bug
report was created because of a flaky test, please file a bug for the flaky
test (if we don't already have one on file) and dup this bug against that bug
so that we can track how often these flaky tests case pain.

"Only you can prevent forest fires." -- Smokey the Bear
"""
        return state
 def blame_string(self, bugs):
     string = "r%s:\n" % self.revision()
     string += "  %s\n" % view_source_url(self.revision())
     string += "  Bug: %s (%s)\n" % (self.bug_id(), bugs.bug_url_for_bug_id(self.bug_id()))
     author_line = "\"%s\" <%s>" % (self.author_name(), self.author_email())
     string += "  Author: %s\n" % (self.author() or author_line)
     string += "  Reviewer: %s\n" % (self.reviewer() or self.reviewer_text())
     string += "  Committer: %s" % self.committer()
     return string
 def blame_string(self, bugs):
     string = "r%s:\n" % self.revision()
     string += "  %s\n" % view_source_url(self.revision())
     string += "  Bug: %s (%s)\n" % (self.bug_id(),
                                     bugs.bug_url_for_bug_id(self.bug_id()))
     author_line = "\"%s\" <%s>" % (self.author_name(), self.author_email())
     string += "  Author: %s\n" % (self.author() or author_line)
     string += "  Reviewer: %s\n" % (self.reviewer()
                                     or self.reviewer_text())
     string += "  Committer: %s" % self.committer()
     return string
Example #6
0
 def post_blame_comment_on_bug(self, commit_info, builders, blame_list):
     if not commit_info.bug_id():
         return
     comment = "%s might have broken %s" % (
         view_source_url(commit_info.revision()),
         join_with_separators([builder.name() for builder in builders]))
     if len(blame_list) > 1:
         comment += "\nThe following changes are on the blame list:\n"
         comment += "\n".join(map(view_source_url, blame_list))
     self._tool.bugs.post_comment_to_bug(commit_info.bug_id(),
                                         comment,
                                         cc=self._sheriffbot.watchers)
Example #7
0
    def post_irc_warning(self, commit_info, builders):
        irc_nicknames = sorted([
            party.irc_nickname for party in commit_info.responsible_parties()
            if party.irc_nickname
        ])
        irc_prefix = ": " if irc_nicknames else ""
        irc_message = "%s%s%s might have broken %s" % (
            ", ".join(irc_nicknames), irc_prefix,
            view_source_url(commit_info.revision()),
            join_with_separators([builder.name() for builder in builders]))

        self._tool.irc().post(irc_message)
 def post_blame_comment_on_bug(self, commit_info, builders, tests):
     if not commit_info.bug_id():
         return
     comment = "%s might have broken %s" % (
         view_source_url(commit_info.revision()),
         join_with_separators([builder.name() for builder in builders]))
     if tests:
         comment += "\nThe following tests are not passing:\n"
         comment += "\n".join(tests)
     self._tool.bugs.post_comment_to_bug(commit_info.bug_id(),
                                         comment,
                                         cc=self._sheriffbot.watchers)
    def post_irc_warning(self, commit_info, builders):
        irc_nicknames = sorted([party.irc_nickname for
                                party in commit_info.responsible_parties()
                                if party.irc_nickname])
        irc_prefix = ": " if irc_nicknames else ""
        irc_message = "%s%s%s might have broken %s" % (
            ", ".join(irc_nicknames),
            irc_prefix,
            view_source_url(commit_info.revision()),
            join_with_separators([builder.name() for builder in builders]))

        self._tool.irc().post(irc_message)
Example #10
0
 def post_blame_comment_on_bug(self, commit_info, builders, blame_list):
     if not commit_info.bug_id():
         return
     comment = "%s might have broken %s" % (
         view_source_url(commit_info.revision()),
         join_with_separators([builder.name() for builder in builders]))
     if len(blame_list) > 1:
         comment += "\nThe following changes are on the blame list:\n"
         comment += "\n".join(map(view_source_url, blame_list))
     self._tool.bugs.post_comment_to_bug(commit_info.bug_id(),
                                         comment,
                                         cc=self._sheriffbot.watchers)
 def execute(self, nick, args, tool, sheriff):
     return "%s: %s" % (nick,
         view_source_url(tool.buildbot.last_green_revision()))
Example #12
0
 def execute(self, nick, args, tool, sheriff):
     return "%s: %s" % (
         nick, view_source_url(tool.buildbot.last_green_revision()))
Example #13
0
def bug_comment_from_svn_revision(svn_revision):
    return "Committed r%s: <%s>" % (svn_revision,
                                    view_source_url(svn_revision))