Changeset 96228 in webkit


Ignore:
Timestamp:
Sep 28, 2011 10:05:55 AM (13 years ago)
Author:
levin@chromium.org
Message:

watchlist: Add support for matching added or deleted lines.
https://bugs.webkit.org/show_bug.cgi?id=68972

Reviewed by Adam Barth.

  • Scripts/webkitpy/common/watchlist/changedlinepattern.py: Added.
  • Scripts/webkitpy/common/watchlist/changedlinepattern_unittest.py: Added.
  • Scripts/webkitpy/common/watchlist/watchlist.py: Comment fix up and fix input

to the pattern match to only have the diff lines instead of the DiffFile.

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

Add tests for the new patterns and combinations of the patterns.

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

Sort imports. Add changeline support.

Location:
trunk/Tools
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r96225 r96228  
     12011-09-28  David Levin  <levin@chromium.org>
     2
     3        watchlist: Add support for matching added or deleted lines.
     4        https://bugs.webkit.org/show_bug.cgi?id=68972
     5
     6        Reviewed by Adam Barth.
     7
     8        * Scripts/webkitpy/common/watchlist/changedlinepattern.py: Added.
     9        * Scripts/webkitpy/common/watchlist/changedlinepattern_unittest.py: Added.
     10        * Scripts/webkitpy/common/watchlist/watchlist.py: Comment fix up and fix input
     11        to the pattern match to only have the diff lines instead of the DiffFile.
     12        * Scripts/webkitpy/common/watchlist/watchlist_unittest.py:
     13        Add tests for the new patterns and combinations of the patterns.
     14        * Scripts/webkitpy/common/watchlist/watchlistparser.py:
     15        Sort imports. Add changeline support.
     16
    1172011-09-28  Carlos Garcia Campos  <cgarcia@igalia.com>
    218
  • trunk/Tools/Scripts/webkitpy/common/watchlist/watchlist.py

    r96170 r96228  
    5555                    continue
    5656
    57                 # See if the definition matches.
     57                # See if the definition matches within one file.
    5858                for pattern in self._definitions[definition]:
    59                     if not pattern.match(path, diff_file):
     59                    if not pattern.match(path, diff_file.lines):
    6060                        break
    6161                else:
  • trunk/Tools/Scripts/webkitpy/common/watchlist/watchlist_unittest.py

    r96170 r96228  
    140140                'messages': set(),
    141141                }, cc_set_and_messages)
     142
     143    def test_added_match(self):
     144        watch_list = self._watch_list_parser.parse(
     145            '{'
     146            '    "DEFINITIONS": {'
     147            '        "WatchList1": {'
     148            '            "in_added_lines": r"RenderStyle::initialBoxOrient",'
     149            '        },'
     150            '        "WatchList2": {'
     151            '            "in_deleted_lines": r"RenderStyle::initialBoxOrient",'
     152            '        },'
     153            '     },'
     154            '    "CC_RULES": {'
     155            '        "WatchList1": [ "eric@webkit.org", ],'
     156            '        "WatchList2": [ "abarth@webkit.org", ],'
     157            '    },'
     158            '}')
     159        cc_set_and_messages = watch_list.determine_cc_set_and_messages(DIFF_TEST_DATA)
     160        self.assertEquals({
     161                'cc_set': set(['eric@webkit.org']),
     162                'messages': set(),
     163                }, cc_set_and_messages)
     164
     165    def test_deleted_match(self):
     166        watch_list = self._watch_list_parser.parse(
     167            '{'
     168            '    "DEFINITIONS": {'
     169            '        "WatchList1": {'
     170            '            "in_added_lines": r"unsigned orient: 1;",'
     171            '        },'
     172            '        "WatchList2": {'
     173            '            "in_deleted_lines": r"unsigned orient: 1;",'
     174            '        },'
     175            '     },'
     176            '    "CC_RULES": {'
     177            '        "WatchList1": [ "eric@webkit.org", ],'
     178            '        "WatchList2": [ "abarth@webkit.org", ],'
     179            '    },'
     180            '}')
     181        cc_set_and_messages = watch_list.determine_cc_set_and_messages(DIFF_TEST_DATA)
     182        self.assertEquals({
     183                'cc_set': set(['abarth@webkit.org']),
     184                'messages': set(),
     185                }, cc_set_and_messages)
     186
     187    def test_complex_match(self):
     188        watch_list = self._watch_list_parser.parse(
     189            '{'
     190            '    "DEFINITIONS": {'
     191            '        "WatchList1": {'
     192            '            "filename": r"WebCore/rendering/style/StyleRareInheritedData\.cpp",'
     193            '            "in_added_lines": r"\&\& boxOrient == o.boxOrient;",'
     194            '            "in_deleted_lines": r"\&\& userSelect == o.userSelect;",'
     195            '        },'
     196            '        "WatchList2": {'
     197            '            "filename": r"WebCore/rendering/style/StyleRareInheritedData\.cpp",'
     198            '            "in_added_lines": r"RenderStyle::initialBoxOrient",'
     199            '        },'
     200            # WatchList3 won't match because these two patterns aren't in the same file.
     201            '        "WatchList3": {'
     202            '            "in_added_lines": r"RenderStyle::initialBoxOrient",'
     203            '            "in_deleted_lines": r"unsigned orient: 1;",'
     204            '        },'
     205            '     },'
     206            '    "CC_RULES": {'
     207            '        "WatchList1": [ "eric@webkit.org", ],'
     208            '        "WatchList3": [ "abarth@webkit.org", ],'
     209            '    },'
     210            '    "MESSAGE_RULES": {'
     211            '        "WatchList2": ["This is a test message."],'
     212            '    },'
     213            '}')
     214        cc_set_and_messages = watch_list.determine_cc_set_and_messages(DIFF_TEST_DATA)
     215        self.assertEquals({
     216                'cc_set': set(['eric@webkit.org']),
     217                'messages': set(["This is a test message."]),
     218                }, cc_set_and_messages)
  • trunk/Tools/Scripts/webkitpy/common/watchlist/watchlistparser.py

    r96170 r96228  
    2828
    2929import re
     30from webkitpy.common.watchlist.changedlinepattern import ChangedLinePattern
     31from webkitpy.common.watchlist.filenamepattern import FilenamePattern
    3032from webkitpy.common.watchlist.watchlist import WatchList
    31 from webkitpy.common.watchlist.filenamepattern import FilenamePattern
    3233from webkitpy.common.watchlist.watchlistrule import WatchListRule
    3334
     
    4546            self._MESSAGE_RULES: self._parse_message_rules,
    4647            }
    47         self._definition_pattern_parsers = {'filename': FilenamePattern, }
     48        self._definition_pattern_parsers = {
     49            'filename': FilenamePattern,
     50            'in_added_lines': (lambda regex: ChangedLinePattern(regex, 0)),
     51            'in_deleted_lines': (lambda regex: ChangedLinePattern(regex, 1)),
     52            }
    4853
    4954    def parse(self, watch_list_contents):
Note: See TracChangeset for help on using the changeset viewer.