Title: [119240] trunk/Tools
- Revision
- 119240
- Author
- [email protected]
- Date
- 2012-06-01 09:03:14 -0700 (Fri, 01 Jun 2012)
Log Message
The ChangeLog parser cannot handle reviewers with initials in their name
https://bugs.webkit.org/show_bug.cgi?id=87864
Patch by Martin Robinson <[email protected]> on 2012-06-01
Reviewed by Ryosuke Niwa.
Add support in the ChangeLog parser for reviewer names that have
initials in them.
* Scripts/webkitpy/common/checkout/changelog.py:
(ChangeLogEntry): Add a new group of regular expressions that need a backreference
in the replacement string. This allows for matching the word characters before a
period, without totally throwing them away.
(ChangeLogEntry._parse_reviewer_text): Use the new regular _expression_.
* Scripts/webkitpy/common/checkout/changelog_unittest.py:
(test_fuzzy_reviewer_match_initial): Add a test for a reviewer name that has an initial.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (119239 => 119240)
--- trunk/Tools/ChangeLog 2012-06-01 16:00:19 UTC (rev 119239)
+++ trunk/Tools/ChangeLog 2012-06-01 16:03:14 UTC (rev 119240)
@@ -1,3 +1,21 @@
+2012-06-01 Martin Robinson <[email protected]>
+
+ The ChangeLog parser cannot handle reviewers with initials in their name
+ https://bugs.webkit.org/show_bug.cgi?id=87864
+
+ Reviewed by Ryosuke Niwa.
+
+ Add support in the ChangeLog parser for reviewer names that have
+ initials in them.
+
+ * Scripts/webkitpy/common/checkout/changelog.py:
+ (ChangeLogEntry): Add a new group of regular expressions that need a backreference
+ in the replacement string. This allows for matching the word characters before a
+ period, without totally throwing them away.
+ (ChangeLogEntry._parse_reviewer_text): Use the new regular _expression_.
+ * Scripts/webkitpy/common/checkout/changelog_unittest.py:
+ (test_fuzzy_reviewer_match_initial): Add a test for a reviewer name that has an initial.
+
2012-06-01 Christophe Dumez <[email protected]>
[EFL] EFL's LayoutTestController needs to implement deliverWebIntent
Modified: trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py (119239 => 119240)
--- trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py 2012-06-01 16:00:19 UTC (rev 119239)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py 2012-06-01 16:03:14 UTC (rev 119240)
@@ -72,7 +72,6 @@
reviewer_name_noise_regexp = re.compile(r"""
(\s+((tweaked\s+)?and\s+)?(landed|committed|okayed)\s+by.+) # "landed by", "commented by", etc...
|(^(Reviewed\s+)?by\s+) # extra "Reviewed by" or "by"
- |\.(?:(\s.+|$)) # text after the first period followed by a space
|([(<]\s*[\w_\-\.]+@[\w_\-\.]+[>)]) # email addresses
|([(<](https?://?bugs.)webkit.org[^>)]+[>)]) # bug url
|("[^"]+") # wresler names like 'Sean/Shawn/Shaun' in 'Geoffrey "Sean/Shawn/Shaun" Garen'
@@ -86,6 +85,10 @@
|(with(\s+[a-z-]+)+) # phrases with "with no hesitation" in "Sam Weinig with no hesitation"
""", re.VERBOSE)
+ reviewer_name_noise_needing_a_backreference_regexp = re.compile(r"""
+ (\S\S)\.(?:(\s.+|$)) # Text after the two word characters (don't match initials) and a period followed by a space.
+ """, re.IGNORECASE | re.VERBOSE)
+
nobody_regexp = re.compile(r"""(\s+|^)nobody(
((,|\s+-)?\s+(\w+\s+)+fix.*) # e.g. nobody, build fix...
|(\s*\([^)]+\).*) # NOBODY (..)...
@@ -118,6 +121,7 @@
reviewer_text = ChangeLogEntry.nobody_regexp.sub('', reviewer_text)
reviewer_text = ChangeLogEntry.reviewer_name_noise_regexp.sub('', reviewer_text)
reviewer_text = ChangeLogEntry.reviewer_name_casesensitive_noise_regexp.sub('', reviewer_text)
+ reviewer_text = ChangeLogEntry.reviewer_name_noise_needing_a_backreference_regexp.sub(r'\1', reviewer_text)
reviewer_text = reviewer_text.replace('(', '').replace(')', '')
reviewer_text = re.sub(r'\s\s+|[,.]\s*$', ' ', reviewer_text).strip()
if not len(reviewer_text):
Modified: trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py (119239 => 119240)
--- trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py 2012-06-01 16:00:19 UTC (rev 119239)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py 2012-06-01 16:03:14 UTC (rev 119240)
@@ -413,6 +413,18 @@
self._assert_fuzzy_reviewer_match('Reviewed by Mark Rowe, but Dan Bernstein also reviewed and asked thoughtful questions.',
['Mark Rowe', 'but Dan Bernstein also reviewed', 'asked thoughtful questions'], ['Mark Rowe'])
+ def test_fuzzy_reviewer_match_initial(self):
+ self._assert_fuzzy_reviewer_match('Reviewed by Alejandro G. Castro.',
+ ['Alejandro G. Castro'], ['Alejandro G. Castro'])
+ self._assert_fuzzy_reviewer_match('Reviewed by G. Alejandro G. Castro and others.',
+ ['G. Alejandro G. Castro', 'others'], ['Alejandro G. Castro'])
+
+ # If a reviewer has a name that ended with an initial, the regular _expression_
+ # will incorrectly trim the last period, but it will still match fuzzily to
+ # the full reviewer name.
+ self._assert_fuzzy_reviewer_match('Reviewed by G. Alejandro G. G. Castro G.',
+ ['G. Alejandro G. G. Castro G'], ['Alejandro G. Castro'])
+
def _assert_parse_authors(self, author_text, expected_contributors):
parsed_authors = [(author['name'], author['email']) for author in self._entry_with_author(author_text).authors()]
self.assertEquals(parsed_authors, expected_contributors)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes