Changeset 56964 in webkit


Ignore:
Timestamp:
Apr 1, 2010 9:31:54 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-04-01 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Improve the error handling in rollout a bit
https://bugs.webkit.org/show_bug.cgi?id=36995

This patch does a few things to make the error handling in rollout a
bit more robust.

  • Scripts/webkitpy/common/checkout/api.py:

The old logic here was wrong. We don't want to resolve the
ChangeLogs (that would remove the old ChangeLog entry). Instead,
we want to revert the ChangeLogs so we can fill them with the new
message.

  • Scripts/webkitpy/tool/commands/download_unittest.py:

Update test expectations because we're using a different mock object.

  • Scripts/webkitpy/tool/commands/download.py:
    • Added an update command to make updating from the SheriffBot more robust.
    • Now that we have CommitInfo, we can automatically CC the responsible parties on the bug we create.
    • Re-ordered the steps in create-rollout. Our original thinking was that we always wanted to create the bug, but that's not really true given how things appear to be playing out. If we fail to apply the reverse diff, we don't want to create the bug.
  • Scripts/webkitpy/tool/commands/sheriffbot.py:
    • Use the new, more robust update command.
  • Scripts/webkitpy/tool/steps/createbug.py:

Allow commands to pre-load who they want to be CCed on a new bug.

Location:
trunk/WebKitTools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r56963 r56964  
     12010-04-01  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Improve the error handling in rollout a bit
     6        https://bugs.webkit.org/show_bug.cgi?id=36995
     7
     8        This patch does a few things to make the error handling in rollout a
     9        bit more robust.
     10
     11        * Scripts/webkitpy/common/checkout/api.py:
     12            The old logic here was wrong.  We don't want to resolve the
     13            ChangeLogs (that would remove the old ChangeLog entry).  Instead,
     14            we want to revert the ChangeLogs so we can fill them with the new
     15            message.
     16        * Scripts/webkitpy/tool/commands/download_unittest.py:
     17            Update test expectations because we're using a different mock object.
     18        * Scripts/webkitpy/tool/commands/download.py:
     19            - Added an update command to make updating from the SheriffBot more
     20              robust.
     21            - Now that we have CommitInfo, we can automatically CC the
     22              responsible parties on the bug we create.
     23            - Re-ordered the steps in create-rollout.  Our original thinking
     24              was that we always wanted to create the bug, but that's not
     25              really true given how things appear to be playing out.  If we
     26              fail to apply the reverse diff, we don't want to create the bug.
     27        * Scripts/webkitpy/tool/commands/sheriffbot.py:
     28            - Use the new, more robust update command.
     29        * Scripts/webkitpy/tool/steps/createbug.py:
     30            Allow commands to pre-load who they want to be CCed on a new bug.
     31
    1322010-04-01  Kent Tamura  <tkent@chromium.org>
    233
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/api.py

    r56891 r56964  
    128128        self._scm.apply_reverse_diff(revision)
    129129
    130         # Fix any ChangeLogs if necessary.
     130        # We don't want to remove the old ChangeLog entry.
    131131        changelog_paths = self.modified_changelogs()
    132132        if len(changelog_paths):
    133             # FIXME: Move _scm.script_path here once we get rid of all the dependencies.
    134             run_command([self._scm.script_path('resolve-ChangeLogs')] + changelog_paths)
     133            self._scm.revert_files(changelog_paths)
    135134
    136135        conflicts = self._scm.conflicted_files()
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/download.py

    r56863 r56964  
    4444
    4545
     46class Update(AbstractSequencedCommand):
     47    name = "update"
     48    help_text = "Update working copy (used internally)"
     49    steps = [
     50        steps.CleanWorkingDirectory,
     51        steps.Update,
     52    ]
     53
     54
    4655class Build(AbstractSequencedCommand):
    4756    name = "build"
     
    244253    argument_names = "REVISION REASON"
    245254
    246     def _bug_id_for_revision(self, revision):
    247         bug_id = self.tool.checkout().bug_id_for_revision(revision)
    248         if bug_id:
    249             log("Preparing rollout for bug %s." % bug_id)
    250             return bug_id
     255    def _commit_info(self, revision):
     256        commit_info = self.tool.checkout().commit_info_for_revision(revision)
     257        if commit_info.bug_id():
     258            # Note: Don't print a bug URL here because it will confuse the
     259            #       SheriffBot because the SheriffBot just greps the output
     260            #       of create-rollout for bug URLs.  It should do better
     261            #       parsing instead.
     262            log("Preparing rollout for bug %s." % commit_info.bug_id())
     263            return commit_info
    251264        log("Unable to parse bug number from diff.")
    252265
    253266    def _prepare_state(self, options, args, tool):
    254267        revision = args[0]
     268        commit_info = self._commit_info(revision)
     269        cc_list = sorted([party.bugzilla_email()
     270                          for party in commit_info.responsible_parties()
     271                          if party.bugzilla_email()])
    255272        return {
    256             "revision" : revision,
    257             "bug_id" : self._bug_id_for_revision(revision),
    258             "reason" : args[1],
     273            "revision": revision,
     274            "bug_id": commit_info.bug_id(),
     275            # FIXME: We should used the list as the canonical representation.
     276            "bug_cc": ",".join(cc_list),
     277            "reason": args[1],
    259278        }
    260279
     
    279298    help_text = "Creates a bug to track a broken SVN revision and uploads a rollout patch."
    280299    steps = [
     300        steps.CleanWorkingDirectory,
     301        steps.Update,
     302        steps.RevertRevision,
    281303        steps.CreateBug,
    282         steps.CleanWorkingDirectory,
    283         steps.Update,
    284         steps.RevertRevision, # Notice that we still create the bug if this step fails.
    285304        steps.PrepareChangeLogForRevert,
    286305        steps.PostDiffForRevert,
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/download_unittest.py

    r56494 r56964  
    118118
    119119    def test_prepare_rollout(self):
    120         expected_stderr="Preparing rollout for bug 12345.\nUpdating working directory\nRunning prepare-ChangeLog\n"
     120        expected_stderr = "Preparing rollout for bug 42.\nUpdating working directory\nRunning prepare-ChangeLog\n"
    121121        self.assert_execute_outputs(PrepareRollout(), [852, "Reason"], options=self._default_options(), expected_stderr=expected_stderr)
    122122
    123123    def test_create_rollout(self):
    124         expected_stderr="Preparing rollout for bug 12345.\nMOCK create_bug\nbug_title: REGRESSION(r852): Reason\nbug_description: http://trac.webkit.org/changeset/852 broke the build:\nReason\nUpdating working directory\nRunning prepare-ChangeLog\n"
     124        expected_stderr = "Preparing rollout for bug 42.\nUpdating working directory\nMOCK create_bug\nbug_title: REGRESSION(r852): Reason\nbug_description: http://trac.webkit.org/changeset/852 broke the build:\nReason\nRunning prepare-ChangeLog\n"
    125125        self.assert_execute_outputs(CreateRollout(), [852, "Reason"], options=self._default_options(), expected_stderr=expected_stderr)
    126126
    127127    def test_rollout(self):
    128         expected_stderr = "Preparing rollout for bug 12345.\nUpdating working directory\nRunning prepare-ChangeLog\nBuilding WebKit\n"
     128        expected_stderr = "Preparing rollout for bug 42.\nUpdating working directory\nRunning prepare-ChangeLog\nBuilding WebKit\n"
    129129        self.assert_execute_outputs(Rollout(), [852, "Reason"], options=self._default_options(), expected_stderr=expected_stderr)
    130130
  • trunk/WebKitTools/Scripts/webkitpy/tool/commands/sheriffbot.py

    r56947 r56964  
    3434from webkitpy.tool.bot.sheriffircbot import SheriffIRCBot
    3535from webkitpy.tool.commands.queues import AbstractQueue
     36from webkitpy.tool.commands.stepsequence import StepSequenceErrorHandler
    3637
    37 class SheriffBot(AbstractQueue):
     38
     39class SheriffBot(AbstractQueue, StepSequenceErrorHandler):
    3840    name = "sheriff-bot"
    3941
    40     def update(self):
    41         self.tool.executive.run_and_throw_if_fail(WebKitPort.update_webkit_command(), quiet=True)
     42    def _update(self):
     43        self.run_webkit_patch(["update", "--force-clean", "--quiet"])
    4244
    4345    # AbstractQueue methods
     
    5456    def next_work_item(self):
    5557        self._irc_bot.process_pending_messages()
    56         self.update()
     58        self._update()
    5759        for svn_revision, builders in self.tool.buildbot.revisions_causing_failures().items():
    5860            if self.tool.status_server.svn_revision(svn_revision):
     
    7577        builders = failure_info["builders"]
    7678
    77         self.update()
     79        self._update()
    7880        commit_info = self.tool.checkout().commit_info_for_revision(svn_revision)
    7981        self._sheriff.post_irc_warning(commit_info, builders)
     
    8789    def handle_unexpected_error(self, failure_info, message):
    8890        log(message)
     91
     92    # StepSequenceErrorHandler methods
     93
     94    @classmethod
     95    def handle_script_error(cls, tool, state, script_error):
     96        # Ideally we would post some information to IRC about what went wrong
     97        # here, but we don't have the IRC password in the child process.
     98        pass
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/createbug.py

    r56497 r56964  
    4343        if state.get("bug_id"):
    4444            return
    45         state["bug_id"] = self._tool.bugs.create_bug(state["bug_title"], state["bug_description"], blocked=state.get("bug_blocked"), component=self._options.component, cc=self._options.cc)
     45        cc = self._options.cc
     46        if not cc:
     47            cc = state["bug_cc"]
     48        state["bug_id"] = self._tool.bugs.create_bug(state["bug_title"], state["bug_description"], blocked=state.get("bug_blocked"), component=self._options.component, cc=cc)
Note: See TracChangeset for help on using the changeset viewer.