Changeset 96228 in webkit
- Timestamp:
- Sep 28, 2011 10:05:55 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r96225 r96228 1 2011-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 1 17 2011-09-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 18 -
trunk/Tools/Scripts/webkitpy/common/watchlist/watchlist.py
r96170 r96228 55 55 continue 56 56 57 # See if the definition matches .57 # See if the definition matches within one file. 58 58 for pattern in self._definitions[definition]: 59 if not pattern.match(path, diff_file ):59 if not pattern.match(path, diff_file.lines): 60 60 break 61 61 else: -
trunk/Tools/Scripts/webkitpy/common/watchlist/watchlist_unittest.py
r96170 r96228 140 140 'messages': set(), 141 141 }, 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 28 28 29 29 import re 30 from webkitpy.common.watchlist.changedlinepattern import ChangedLinePattern 31 from webkitpy.common.watchlist.filenamepattern import FilenamePattern 30 32 from webkitpy.common.watchlist.watchlist import WatchList 31 from webkitpy.common.watchlist.filenamepattern import FilenamePattern32 33 from webkitpy.common.watchlist.watchlistrule import WatchListRule 33 34 … … 45 46 self._MESSAGE_RULES: self._parse_message_rules, 46 47 } 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 } 48 53 49 54 def parse(self, watch_list_contents):
Note: See TracChangeset
for help on using the changeset viewer.