Changeset 96441 in webkit


Ignore:
Timestamp:
Sep 30, 2011 5:39:52 PM (13 years ago)
Author:
levin@chromium.org
Message:

watchlist: Add a way to detect a net increase or decrease of a pattern (in a file).
https://bugs.webkit.org/show_bug.cgi?id=69031

Reviewed by Adam Barth.

  • Scripts/webkitpy/common/config/watchlist: Added usage of the new pattern,

a comment to explain something important about the email addresses, and
a comment to let emacs know to treat the file as a python file.

  • Scripts/webkitpy/common/watchlist/amountchangedpattern.py: Added.

Detects increases or decreases in a pattern.

  • Scripts/webkitpy/common/watchlist/amountchangedpattern_unittest.py: Added.
  • Scripts/webkitpy/common/watchlist/watchlist_unittest.py:

Added unit tests for watchlist which has "more" or "less".

  • Scripts/webkitpy/common/watchlist/watchlistparser.py:

Added support for "more" or "less".

Location:
trunk/Tools
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r96439 r96441  
     12011-09-30  David Levin  <levin@chromium.org>
     2
     3        watchlist: Add a way to detect a net increase or decrease of a pattern (in a file).
     4        https://bugs.webkit.org/show_bug.cgi?id=69031
     5
     6        Reviewed by Adam Barth.
     7
     8        * Scripts/webkitpy/common/config/watchlist: Added usage of the new pattern,
     9        a comment to explain something important about the email addresses, and
     10        a comment to let emacs know to treat the file as a python file.
     11        * Scripts/webkitpy/common/watchlist/amountchangedpattern.py: Added.
     12        Detects increases or decreases in a pattern.
     13        * Scripts/webkitpy/common/watchlist/amountchangedpattern_unittest.py: Added.
     14        * Scripts/webkitpy/common/watchlist/watchlist_unittest.py:
     15        Added unit tests for watchlist which has "more" or "less".
     16        * Scripts/webkitpy/common/watchlist/watchlistparser.py:
     17        Added support for "more" or "less".
     18
    1192011-09-30  Sam Weinig  <sam@webkit.org>
    220
  • trunk/Tools/Scripts/webkitpy/common/config/watchlist

    r96263 r96441  
     1#  -*- mode: Python;-*-
    12{
    23    "DEFINITIONS": {
    34        "WatchListScript": {
    4             "filename": (r"Tools/Scripts/webkitpy/common/watchlist/.*"),
     5            "filename": r"Tools/Scripts/webkitpy/common/watchlist/.*",
     6        },
     7        "ThreadingFiles": {
     8            "filename": r"Source/JavaScriptCore/wtf/ThreadSafeRefCounted\.h"
     9                        r"|Source/JavaScriptCore/wtf/Threading\.h",
     10        },
     11        "ThreadingUsage": {
     12            "more": r"deprecatedTurnOffVerifier|crossThreadString|threadsafeCopy|ThreadSafeRefCounted|CrossThreadRefCounted",
    513        },
    614    },
    715    "CC_RULES": {
     16        # Note: All email addresses listed must be registered with bugzilla.
     17        # Specifically, levin@chromium.org and levin+threading@chromium.org are
     18        # two different accounts as far as bugzilla is concerned.
    819        "WatchListScript": [ "levin+watchlist@chromium.org", ],
     20        "ThreadingFiles|ThreadingUsage": [ "levin+threading@chromium.org", ],
    921    },
    1022}
  • trunk/Tools/Scripts/webkitpy/common/watchlist/watchlist_unittest.py

    r96390 r96441  
    213213                }, cc_set_and_messages)
    214214
     215    def test_more_and_less_match(self):
     216        watch_list = self._watch_list_parser.parse(
     217            '{'
     218            '    "DEFINITIONS": {'
     219            '        "WatchList1": {'
     220            # This pattern is in both added and deleted lines, so no match.
     221            '            "more": r"userSelect == o\.userSelect",'
     222            '        },'
     223            '        "WatchList2": {'
     224            '            "more": r"boxOrient\(o\.boxOrient\)",'
     225            '        },'
     226            '        "WatchList3": {'
     227            '            "less": r"unsigned orient"'
     228            '        },'
     229            '     },'
     230            '    "CC_RULES": {'
     231            '        "WatchList1": [ "eric@webkit.org", ],'
     232            '        "WatchList2": [ "levin@chromium.org", ],'
     233            '    },'
     234            '    "MESSAGE_RULES": {'
     235            '        "WatchList3": ["Test message."],'
     236            '    },'
     237            '}')
     238        cc_set_and_messages = watch_list.determine_cc_set_and_messages(DIFF_TEST_DATA)
     239        self.assertEquals({
     240                'cc_set': set(['levin@chromium.org']),
     241                'messages': set(["Test message."]),
     242                }, cc_set_and_messages)
     243
    215244    def test_complex_match(self):
    216245        watch_list = self._watch_list_parser.parse(
     
    219248            '        "WatchList1": {'
    220249            '            "filename": r"WebCore/rendering/style/StyleRareInheritedData\.cpp",'
    221             '            "in_added_lines": r"\&\& boxOrient == o.boxOrient;",'
    222             '            "in_deleted_lines": r"\&\& userSelect == o.userSelect;",'
     250            '            "in_added_lines": r"\&\& boxOrient == o\.boxOrient;",'
     251            '            "in_deleted_lines": r"\&\& userSelect == o\.userSelect;",'
     252            '            "more": r"boxOrient\(o\.boxOrient\)",'
    223253            '        },'
    224254            '        "WatchList2": {'
    225255            '            "filename": r"WebCore/rendering/style/StyleRareInheritedData\.cpp",'
    226256            '            "in_added_lines": r"RenderStyle::initialBoxOrient",'
     257            '            "less": r"userSelect;"'
    227258            '        },'
    228259            # WatchList3 won't match because these two patterns aren't in the same file.
  • trunk/Tools/Scripts/webkitpy/common/watchlist/watchlistparser.py

    r96390 r96441  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
     29
    2930import difflib
    3031import re
    3132
     33from webkitpy.common.watchlist.amountchangedpattern import AmountChangedPattern
    3234from webkitpy.common.watchlist.changedlinepattern import ChangedLinePattern
    3335from webkitpy.common.watchlist.filenamepattern import FilenamePattern
     
    5254            'in_added_lines': (lambda regex: ChangedLinePattern(regex, 0)),
    5355            'in_deleted_lines': (lambda regex: ChangedLinePattern(regex, 1)),
     56            'less': (lambda regex: AmountChangedPattern(regex, 1)),
     57            'more': (lambda regex: AmountChangedPattern(regex, 0)),
    5458        }
    5559
Note: See TracChangeset for help on using the changeset viewer.