Changeset 143504 in webkit


Ignore:
Timestamp:
Feb 20, 2013 2:03:49 PM (11 years ago)
Author:
tony@chromium.org
Message:

Parse author names with commas in ChangeLogs
https://bugs.webkit.org/show_bug.cgi?id=110356

Reviewed by Dirk Pranke.

Paweł's name has a comma in it, which was confusing the ChangeLog parser.

  • Scripts/webkitpy/common/checkout/changelog.py:

(ChangeLogEntry): Move name splitting regexp into a constant.
(ChangeLogEntry._parse_reviewer_text): Use _split_reviewer_names.
(ChangeLogEntry._split_reviewer_names): Rename to be more specific.
(ChangeLogEntry._split_author_names_with_emails): Rename to be more specific and require emails.
(ChangeLogEntry._parse_author_text): Use _split_author_names_with_emails.

  • Scripts/webkitpy/common/checkout/changelog_unittest.py:

(test_parse_authors): Test case with Paweł's name.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r143502 r143504  
     12013-02-20  Tony Chang  <tony@chromium.org>
     2
     3        Parse author names with commas in ChangeLogs
     4        https://bugs.webkit.org/show_bug.cgi?id=110356
     5
     6        Reviewed by Dirk Pranke.
     7
     8        Paweł's name has a comma in it, which was confusing the ChangeLog parser.
     9
     10        * Scripts/webkitpy/common/checkout/changelog.py:
     11        (ChangeLogEntry): Move name splitting regexp into a constant.
     12        (ChangeLogEntry._parse_reviewer_text): Use _split_reviewer_names.
     13        (ChangeLogEntry._split_reviewer_names): Rename to be more specific.
     14        (ChangeLogEntry._split_author_names_with_emails): Rename to be more specific and require emails.
     15        (ChangeLogEntry._parse_author_text): Use _split_author_names_with_emails.
     16        * Scripts/webkitpy/common/checkout/changelog_unittest.py:
     17        (test_parse_authors): Test case with Paweł's name.
     18
    1192013-02-15  Dirk Schulze  <krit@webkit.org>
    220
  • trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py

    r141829 r143504  
    105105    svn_id_regexp = r'git-svn-id: http://svn.webkit.org/repository/webkit/trunk@(?P<svnid>\d+) '
    106106
     107    split_names_regexp = r'\s*(?:,(?:\s+and\s+|&)?|(?:^|\s+)and\s+|&&|[/+&])\s*'
     108
    107109    def __init__(self, contents, committer_list=CommitterList(), revision=None):
    108110        self._contents = contents
     
    132134            return None, None
    133135
    134         reviewer_list = ChangeLogEntry._split_contributor_names(reviewer_text)
     136        reviewer_list = ChangeLogEntry._split_reviewer_names(reviewer_text)
    135137
    136138        # Get rid of "reviewers" like "even though this is just a..." in "Reviewed by Sam Weinig, even though this is just a..."
     
    141143
    142144    @classmethod
    143     def _split_contributor_names(cls, text):
    144         return re.split(r'\s*(?:,(?:\s+and\s+|&)?|(?:^|\s+)and\s+|&&|[/+&])\s*', text)
     145    def _split_reviewer_names(cls, text):
     146        return re.split(ChangeLogEntry.split_names_regexp, text)
     147
     148    @classmethod
     149    def _split_author_names_with_emails(cls, text):
     150        regex = '>' + ChangeLogEntry.split_names_regexp
     151        names = re.split(regex, text)
     152        if len(names) > 1:
     153            names = [name + ">" for name in names[:-1]] + [names[-1]]
     154        return names
    145155
    146156    def _fuzz_match_reviewers(self, reviewers_text_list):
     
    160170        if not text:
    161171            return []
    162         authors = cls._split_contributor_names(text)
     172        authors = cls._split_author_names_with_emails(text)
    163173        assert(authors and len(authors) >= 1)
    164174        return [cls._parse_author_name_and_email(author) for author in authors]
  • trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py

    r141829 r143504  
    454454        self._assert_parse_authors('Adam Barth  <abarth@webkit.org> && Benjamin Poulain  <bpoulain@apple.com>',
    455455            [('Adam Barth', 'abarth@webkit.org'), ('Benjamin Poulain', 'bpoulain@apple.com')])
     456        self._assert_parse_authors(u'Pawe\u0142 Hajdan, Jr.  <phajdan.jr@chromium.org>',
     457            [(u'Pawe\u0142 Hajdan, Jr.', u'phajdan.jr@chromium.org')])
     458        self._assert_parse_authors(u'Pawe\u0142 Hajdan, Jr.  <phajdan.jr@chromium.org>, Adam Barth  <abarth@webkit.org>',
     459            [(u'Pawe\u0142 Hajdan, Jr.', u'phajdan.jr@chromium.org'), (u'Adam Barth', u'abarth@webkit.org')])
    456460
    457461    def _assert_has_valid_reviewer(self, reviewer_line, expected):
Note: See TracChangeset for help on using the changeset viewer.