Changeset 53079 in webkit


Ignore:
Timestamp:
Jan 11, 2010 8:50:07 AM (14 years ago)
Author:
abarth@webkit.org
Message:

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

Reviewed by David Kilzer.

bugzilla-tool submit-patch mistakenly picks up bug URLs in non-ChangeLog files
https://bugs.webkit.org/show_bug.cgi?id=33197

We should just search for bug numbers in the ChangeLogs instead of in
the whole diff.

  • Scripts/test-webkitpy:
  • Scripts/webkitpy/commands/abstractdiffcommand.py: Added.
  • Scripts/webkitpy/commands/abstractdiffcommand_unittest.py: Added.
  • Scripts/webkitpy/commands/download.py:
  • Scripts/webkitpy/commands/upload.py:
  • Scripts/webkitpy/mock_bugzillatool.py:
Location:
trunk/WebKitTools
Files:
1 added
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r53076 r53079  
     12010-01-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by David Kilzer.
     4
     5        bugzilla-tool submit-patch mistakenly picks up bug URLs in non-ChangeLog files
     6        https://bugs.webkit.org/show_bug.cgi?id=33197
     7
     8        We should just search for bug numbers in the ChangeLogs instead of in
     9        the whole diff.
     10 
     11        * Scripts/test-webkitpy:
     12        * Scripts/webkitpy/commands/abstractdiffcommand.py: Added.
     13        * Scripts/webkitpy/commands/abstractdiffcommand_unittest.py: Added.
     14        * Scripts/webkitpy/commands/download.py:
     15        * Scripts/webkitpy/commands/upload.py:
     16        * Scripts/webkitpy/mock_bugzillatool.py:
     17
    1182010-01-11  Chris Jerdonek  <chris.jerdonek@gmail.com>
    219
  • trunk/WebKitTools/Scripts/test-webkitpy

    r53043 r53079  
    3434from webkitpy.buildbot_unittest import *
    3535from webkitpy.changelogs_unittest import *
     36from webkitpy.commands.abstractdiffcommand_unittest import *
    3637from webkitpy.commands.download_unittest import *
    3738from webkitpy.commands.early_warning_system_unittest import *
  • trunk/WebKitTools/Scripts/webkitpy/commands/abstractdiffcommand.py

    • Property svn:executable deleted
    r53078 r53079  
    1 #!/usr/bin/env python
    2 # Copyright (c) 2009 Google Inc. All rights reserved.
     1# Copyright (C) 2010 Google Inc. All rights reserved.
    32#
    43# Redistribution and use in source and binary forms, with or without
     
    2827# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2928
    30 import sys
    31 import unittest
     29from webkitpy.bugzilla import parse_bug_id
     30from webkitpy.commands.abstractsequencedcommand import AbstractSequencedCommand
    3231
    33 from webkitpy.bugzilla_unittest import *
    34 from webkitpy.buildbot_unittest import *
    35 from webkitpy.changelogs_unittest import *
    36 from webkitpy.commands.download_unittest import *
    37 from webkitpy.commands.early_warning_system_unittest import *
    38 from webkitpy.commands.upload_unittest import *
    39 from webkitpy.commands.queries_unittest import *
    40 from webkitpy.commands.queues_unittest import *
    41 from webkitpy.committers_unittest import *
    42 from webkitpy.credentials_unittest import *
    43 from webkitpy.diff_parser_unittest import *
    44 from webkitpy.executive_unittest import *
    45 from webkitpy.multicommandtool_unittest import *
    46 from webkitpy.networktransaction_unittest import *
    47 from webkitpy.queueengine_unittest import *
    48 from webkitpy.steps.steps_unittest import *
    49 from webkitpy.steps.updatechangelogswithreview_unittests import *
    50 from webkitpy.style.unittests import * # for check-webkit-style
    51 from webkitpy.webkit_logging_unittest import *
    52 from webkitpy.webkitport_unittest import *
    5332
    54 if __name__ == "__main__":
    55     # FIXME: This is a hack, but I'm tired of commenting out the test.
    56     #        See https://bugs.webkit.org/show_bug.cgi?id=31818
    57     if len(sys.argv) > 1 and sys.argv[1] == "--all":
    58         sys.argv.remove("--all")
    59         from webkitpy.scm_unittest import *
    60 
    61     unittest.main()
     33class AbstractDiffCommand(AbstractSequencedCommand):
     34    def _bug_id(self, args, tool):
     35        # Perfer a bug id passed as an argument over a bug URL in the ChangeLogs.
     36        bug_id = args and args[0]
     37        if not bug_id:
     38            bug_id = parse_bug_id(tool.scm().commit_message_for_this_commit().message())
     39        return bug_id
  • trunk/WebKitTools/Scripts/webkitpy/commands/download.py

    r53066 r53079  
    3737# We could instead use from modules import buildsteps and then prefix every buildstep with "buildsteps."
    3838from webkitpy.changelogs import ChangeLog
     39from webkitpy.commands.abstractdiffcommand import AbstractDiffCommand
    3940from webkitpy.commands.abstractsequencedcommand import AbstractSequencedCommand
    4041from webkitpy.comments import bug_comment_from_commit_text
     
    6768
    6869
    69 class Land(AbstractSequencedCommand):
     70class Land(AbstractDiffCommand):
    7071    name = "land"
    7172    help_text = "Land the current working directory diff and updates the associated bug if any"
     
    8990            "patch" : {
    9091                "id" : None,
    91                 "bug_id" : (args and args[0]) or parse_bug_id(tool.scm().create_patch()),
     92                "bug_id" : self._bug_id(args, tool),
    9293            }
    9394        }
     
    269270    def _parse_bug_id_from_revision_diff(tool, revision):
    270271        original_diff = tool.scm().diff_for_revision(revision)
     272        # FIXME: This is wrong because it picks up bug numbers outside of ChangeLogs
    271273        return parse_bug_id(original_diff)
    272274
  • trunk/WebKitTools/Scripts/webkitpy/commands/upload.py

    r53066 r53079  
    3939
    4040from webkitpy.bugzilla import parse_bug_id
     41from webkitpy.commands.abstractdiffcommand import AbstractDiffCommand
    4142from webkitpy.commands.abstractsequencedcommand import AbstractSequencedCommand
    4243from webkitpy.comments import bug_comment_from_svn_revision
     
    100101
    101102
    102 class AbstractPatchUploadingCommand(AbstractSequencedCommand):
    103     def _bug_id(self, args, tool, state):
    104         # Perfer a bug id passed as an argument over a bug url in the diff (i.e. ChangeLogs).
    105         bug_id = args and args[0]
    106         if not bug_id:
    107             state["diff"] = tool.scm().create_patch()
    108             bug_id = parse_bug_id(state["diff"])
    109         return bug_id
    110 
    111 
    112 class Post(AbstractPatchUploadingCommand):
     103class Post(AbstractDiffCommand):
    113104    name = "post"
    114105    help_text = "Attach the current working directory diff to a bug as a patch file"
     
    123114
    124115    def _prepare_state(self, options, args, tool):
    125         state = {}
    126         state["bug_id"] = self._bug_id(args, tool, state)
     116        state = { "bug_id" : self._bug_id(args, tool) }
    127117        if not state["bug_id"]:
    128118            error("No bug id passed and no bug url found in diff, can't post.")
     
    146136
    147137
    148 class Upload(AbstractPatchUploadingCommand):
     138class Upload(AbstractDiffCommand):
    149139    name = "upload"
    150140    help_text = "Automates the process of uploading a patch for review"
     
    170160
    171161    def _prepare_state(self, options, args, tool):
    172         state = {}
    173         state["bug_id"] = self._bug_id(args, tool, state)
     162        state = { "bug_id" : self._bug_id(args, tool) }
    174163        return state
    175164
  • trunk/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py

    r52724 r53079  
    157157        return ["Commitish1", "Commitish2"]
    158158
     159    def commit_message_for_this_commit(self):
     160        return CommitMessage(["CommitMessage1", "https://bugs.webkit.org/show_bug.cgi?id=93"])
     161
    159162    def commit_message_for_local_commit(self, commit_id):
    160163        if commit_id == "Commitish1":
    161             return CommitMessage("CommitMessage1\nhttps://bugs.example.org/show_bug.cgi?id=42\n")
     164            return CommitMessage(["CommitMessage1", "https://bugs.webkit.org/show_bug.cgi?id=42"])
    162165        if commit_id == "Commitish2":
    163             return CommitMessage("CommitMessage2\nhttps://bugs.example.org/show_bug.cgi?id=75\n")
     166            return CommitMessage(["CommitMessage2", "https://bugs.webkit.org/show_bug.cgi?id=75"])
    164167        raise Exception("Bogus commit_id in commit_message_for_local_commit.")
    165168
Note: See TracChangeset for help on using the changeset viewer.