⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 228303 in webkit


Ignore:
Timestamp:
Feb 8, 2018, 5:24:36 PM (9 years ago)
Author:
Jonathan Bedard
Message:

webkit-patch suggest-reviewers dies with AttributeError: 'NoneType' object has no attribute 'revision'
https://bugs.webkit.org/show_bug.cgi?id=182584

Reviewed by Daniel Bates.

It is possible that a specific revision has an empty ChangeLog. In this case, Checkout.commit_info_for_revision
will return 'None'. Checkout.recent_commit_infos_for_files should never return a set with 'None' in it.

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

(Checkout.recent_commit_infos_for_files): Remove any empty commit information from the set.

  • Scripts/webkitpy/common/checkout/checkout_unittest.py: Add a file which references an empty ChangeLog.
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r228282 r228303  
     12018-02-08  Jonathan Bedard  <jbedard@apple.com>
     2
     3        webkit-patch suggest-reviewers dies with AttributeError: 'NoneType' object has no attribute 'revision'
     4        https://bugs.webkit.org/show_bug.cgi?id=182584
     5
     6        Reviewed by Daniel Bates.
     7
     8        It is possible that a specific revision has an empty ChangeLog. In this case, Checkout.commit_info_for_revision
     9        will return 'None'. Checkout.recent_commit_infos_for_files should never return a set with 'None' in it.
     10
     11        * Scripts/webkitpy/common/checkout/checkout.py:
     12        (Checkout.recent_commit_infos_for_files): Remove any empty commit information from the set.
     13        * Scripts/webkitpy/common/checkout/checkout_unittest.py: Add a file which references an empty ChangeLog.
     14
    1152018-02-08  Matt Lewis  <jlewis3@apple.com>
    216
  • trunk/Tools/Scripts/webkitpy/common/checkout/checkout.py

    r225733 r228303  
    138138    def recent_commit_infos_for_files(self, paths):
    139139        revisions = set(sum(map(self._scm.revisions_changing_file, paths), []))
    140         return set(map(self.commit_info_for_revision, revisions))
     140        # Remove a None entry from the set. This can happen if a revision does have an associated ChangeLog entry (e.g. r185745).
     141        return set(map(self.commit_info_for_revision, revisions)) - set([None])
    141142
    142143    def suggested_reviewers(self, git_commit, changed_files=None):
  • trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py

    r223177 r228303  
    419419    def test_suggested_reviewers(self):
    420420        def mock_changelog_entries_for_revision(revision, changed_files=None):
     421            if revision == 27:
     422                return []
    421423            if revision % 2 == 0:
    422424                return [ChangeLogEntry(_changelog1entry1)]
     
    424426
    425427        def mock_revisions_changing_file(path, limit=5):
    426             if path.endswith("ChangeLog"):
     428            if path.endswith('ChangeLog'):
    427429                return [3]
     430            if path.endswith('file_with_empty_changelog'):
     431                return [27]
    428432            return [4, 8]
    429433
    430434        checkout = self._make_checkout()
    431         checkout._scm.checkout_root = "/foo/bar"
    432         checkout._scm.changed_files = lambda git_commit: ["file1", "file2", "relative/path/ChangeLog"]
     435        checkout._scm.checkout_root = '/foo/bar'
     436        checkout._scm.changed_files = lambda git_commit: ['file1', 'file2', 'relative/path/ChangeLog', 'file_with_empty_changelog']
    433437        checkout._scm.revisions_changing_file = mock_revisions_changing_file
    434438        checkout.changelog_entries_for_revision = mock_changelog_entries_for_revision
Note: See TracChangeset for help on using the changeset viewer.