Skip to content

Commit

Permalink
Remove more webkitpy.common.net.bugzilla and webkitpy.w3c dead code
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268094

Reviewed by Jonathan Bedard.

Largely found via `vulture webkitpy --exclude '.tox,*_unittest.py,*_integrationtest.py'`

* Tools/Scripts/webkitpy/common/net/bugzilla/attachment.py:
(Attachment):
(Attachment.id):
(Attachment.is_patch):
(Attachment.name):
(Attachment.attacher): Deleted.
(Attachment.attacher_email): Deleted.
(Attachment.is_obsolete): Deleted.
(Attachment.is_revert): Deleted.
(Attachment.attach_date): Deleted.
* Tools/Scripts/webkitpy/common/net/bugzilla/bug.py:
(Bug.is_closed):
(Bug.patches):
(Bug.reviewed_patches):
(Bug.is_in_comments):
(Bug.duplicate_of): Deleted.
(Bug.unreviewed_patches): Deleted.
(Bug.commit_queued_patches): Deleted.
(Bug.commit_revision): Deleted.
* Tools/Scripts/webkitpy/common/net/bugzilla/bug_unittest.py:
(BugTest.test_is_in_comments):
(BugTest.test_commit_revision): Deleted.
* Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(BugzillaQueries.__init__):
(BugzillaQueries._load_query):
(BugzillaQueries.fetch_quips):
(Bugzilla.__init__):
(Bugzilla.open_url):
(Bugzilla.bug_url_for_bug_id):
(Bugzilla.attachment_url_for_id):
(Bugzilla._parse_log_descr_element):
(Bugzilla._filename_for_upload):
(Bugzilla.clear_attachment_flags):
(EditUsersParser): Deleted.
(EditUsersParser.__init__): Deleted.
(EditUsersParser._login_and_uid_from_row): Deleted.
(EditUsersParser.login_userid_pairs_from_edit_user_results): Deleted.
(EditUsersParser._group_name_and_string_from_row): Deleted.
(EditUsersParser.user_dict_from_edit_user_page): Deleted.
(EditUsersParser._group_rows_from_edit_user_page): Deleted.
(EditUsersParser.group_string_from_name): Deleted.
(BugzillaQueries._is_xml_bugs_form): Deleted.
(BugzillaQueries._parse_result_count): Deleted.
(BugzillaQueries._fetch_bugs_from_advanced_query): Deleted.
(BugzillaQueries._fetch_bug): Deleted.
(BugzillaQueries._fetch_bug_ids_advanced_query): Deleted.
(BugzillaQueries._parse_attachment_ids_request_query): Deleted.
(BugzillaQueries._fetch_attachment_ids_request_query): Deleted.
(BugzillaQueries.fetch_bug_ids_from_pending_commit_list): Deleted.
(BugzillaQueries.fetch_bugs_matching_quicksearch): Deleted.
(BugzillaQueries.fetch_bugs_matching_search): Deleted.
(BugzillaQueries.fetch_patches_from_pending_commit_list): Deleted.
(BugzillaQueries.fetch_bugs_from_review_queue): Deleted.
(BugzillaQueries.fetch_bug_ids_from_commit_queue): Deleted.
(BugzillaQueries.fetch_patches_from_commit_queue): Deleted.
(BugzillaQueries.fetch_bug_ids_from_review_queue): Deleted.
(BugzillaQueries.fetch_patches_from_review_queue): Deleted.
(BugzillaQueries.fetch_attachment_ids_from_review_queue): Deleted.
(BugzillaQueries.fetch_login_userid_pairs_matching_substring): Deleted.
(Bugzilla.fetch_user): Deleted.
(Bugzilla.add_user_to_groups): Deleted.
(Bugzilla.short_bug_url_for_bug_id): Deleted.
(Bugzilla.edit_user_url_for_id): Deleted.
(Bugzilla._parse_bugs_from_xml): Deleted.
(Bugzilla.add_attachment_to_bug): Deleted.
(Bugzilla.set_flag_on_attachment): Deleted.
* Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py:
(MockBugzillaQueries.__init__):
(MockBugzilla.fetch_bug):
(MockBugzilla.reassign_bug):
(MockBugzilla.post_comment_to_bug):
(MockBugzillaQueries._all_bugs): Deleted.
(MockBugzillaQueries.fetch_bug_ids_from_commit_queue): Deleted.
(MockBugzillaQueries.fetch_attachment_ids_from_review_queue): Deleted.
(MockBugzillaQueries.fetch_patches_from_commit_queue): Deleted.
(MockBugzillaQueries.fetch_bug_ids_from_pending_commit_list): Deleted.
(MockBugzillaQueries.fetch_bugs_from_review_queue): Deleted.
(MockBugzillaQueries.fetch_patches_from_pending_commit_list): Deleted.
(MockBugzillaQueries.fetch_bugs_matching_search): Deleted.
(MockBugzillaQueries.fetch_bugs_matching_quicksearch): Deleted.
(MockBugzilla.set_override_patch): Deleted.
(MockBugzilla.set_flag_on_attachment): Deleted.
(MockBugzilla.add_attachment_to_bug): Deleted.
* Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py:
(test_url_creation):
(test_parse_bug_id):
(test_user_dict_from_edit_user_page): Deleted.
* Tools/Scripts/webkitpy/w3c/common.py:
(read_credentials):
(is_testharness_baseline): Deleted.
(is_basename_skipped): Deleted.
(is_file_exportable): Deleted.
* Tools/Scripts/webkitpy/w3c/test_downloader.py:
(TestDownloader.__init__):
* Tools/Scripts/webkitpy/w3c/test_exporter.py:
(WebPlatformTestExporter._ensure_new_branch_name):
(WebPlatformTestExporter.download_and_commit_patch): Deleted.
* Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py:
(TestExporterTest.MockGit.push):
(TestExporterTest.MockGit.format_patch): Deleted.
* Tools/Scripts/webkitpy/w3c/test_importer.py:
* Tools/Scripts/webkitpy/w3c/test_importer_unittest.py:
(TestImporterTest.import_downloaded_tests):
(TestImporterTest.import_downloaded_tests.TestDownloaderMock): Deleted.
(TestImporterTest.import_downloaded_tests.TestDownloaderMock.__init__): Deleted.
(TestImporterTest.import_downloaded_tests.TestDownloaderMock._git_submodules_status): Deleted.
* Tools/Scripts/webkitpy/w3c/test_parser.py:
(TestParser.is_slow_test):
(TestParser.has_fuzzy_metadata): Deleted.
* Tools/Scripts/webkitpy/w3c/wpt_github.py:
(WPTGitHub.__init__):
(WPTGitHub.request):
(WPTGitHub.create_pr):
(WPTGitHub.add_label):
(MergeError.__init__):
(WPTGitHub.extract_link_next): Deleted.
(WPTGitHub.update_pr): Deleted.
(WPTGitHub.remove_label): Deleted.
(WPTGitHub.make_pr_from_item): Deleted.
(WPTGitHub.all_pull_requests): Deleted.
(WPTGitHub.get_pr_branch): Deleted.
(WPTGitHub.is_pr_merged): Deleted.
(WPTGitHub.merge_pr): Deleted.
(WPTGitHub.delete_remote_branch): Deleted.
(WPTGitHub.pr_for_chromium_commit): Deleted.
(WPTGitHub.pr_with_change_id): Deleted.
(WPTGitHub.pr_with_position): Deleted.
* Tools/Scripts/webkitpy/w3c/wpt_github_mock.py:
(MockWPTGitHub.__init__):
(MockWPTGitHub.create_pr):
(MockWPTGitHub.add_label):
(MockWPTGitHub.all_pull_requests): Deleted.
(MockWPTGitHub.is_pr_merged): Deleted.
(MockWPTGitHub.merge_pr): Deleted.
(MockWPTGitHub.update_pr): Deleted.
(MockWPTGitHub.delete_remote_branch): Deleted.
(MockWPTGitHub.remove_label): Deleted.
(MockWPTGitHub.get_pr_branch): Deleted.
(MockWPTGitHub.pr_for_chromium_commit): Deleted.
(MockWPTGitHub.pr_with_position): Deleted.
(MockWPTGitHub.pr_with_change_id): Deleted.
* Tools/Scripts/webkitpy/w3c/wpt_runner_unittest.py:

Canonical link: https://commits.webkit.org/273556@main
  • Loading branch information
gsnedders committed Jan 26, 2024
1 parent bfb351d commit 7841b27
Show file tree
Hide file tree
Showing 16 changed files with 6 additions and 1,016 deletions.
17 changes: 0 additions & 17 deletions Tools/Scripts/webkitpy/common/net/bugzilla/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
class Attachment(object):
fast_cq_preamble = "[fast-cq] "
revert_preamble = "REVERT of "
rollout_preamble = "ROLLOUT of "

def __init__(self, attachment_dictionary, bug):
self._attachment_dictionary = attachment_dictionary
Expand All @@ -53,13 +52,6 @@ def _bugzilla(self):
def id(self):
return int(self._attachment_dictionary.get("id"))

@memoized
def attacher(self):
return self._bugzilla().committers.contributor_by_email(self.attacher_email())

def attacher_email(self):
return self._attachment_dictionary.get("attacher_email")

def bug(self):
return self._bug

Expand All @@ -75,18 +67,9 @@ def bug_id(self):
def is_patch(self):
return not not self._attachment_dictionary.get("is_patch")

def is_obsolete(self):
return not not self._attachment_dictionary.get("is_obsolete")

def is_revert(self):
return self.name().startswith(self.revert_preamble) or self.name().startswith(self.rollout_preamble)

def name(self):
return self._attachment_dictionary.get("name")

def attach_date(self):
return self._attachment_dictionary.get("attach_date")

def review(self):
return self._attachment_dictionary.get("review")

Expand Down
25 changes: 0 additions & 25 deletions Tools/Scripts/webkitpy/common/net/bugzilla/bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ def is_open(self):
def is_closed(self):
return not self.is_open()

def duplicate_of(self):
return self.bug_dictionary.get('dup_id', None)

# Rarely do we actually want obsolete attachments
def attachments(self, include_obsolete=False):
attachments = self.bug_dictionary["attachments"]
Expand All @@ -95,9 +92,6 @@ def patches(self, include_obsolete=False):
return [patch for patch in self.attachments(include_obsolete)
if patch.is_patch()]

def unreviewed_patches(self):
return [patch for patch in self.patches() if patch.review() == "?"]

def reviewed_patches(self, include_invalid=False):
patches = [patch for patch in self.patches() if patch.review() == "+"]
if include_invalid:
Expand All @@ -106,15 +100,6 @@ def reviewed_patches(self, include_invalid=False):
# reviewer.
return list(filter(lambda patch: patch.reviewer(), patches))

def commit_queued_patches(self, include_invalid=False):
patches = [patch for patch in self.patches()
if patch.commit_queue() == "+"]
if include_invalid:
return patches
# Checking committer() ensures that it was both commit-queue+'d and has
# a valid committer.
return list(filter(lambda patch: patch.committer(), patches))

def comments(self):
return self.bug_dictionary["comments"]

Expand All @@ -123,13 +108,3 @@ def is_in_comments(self, message):
if message in comment["text"]:
return True
return False

def commit_revision(self):
# Sort the comments in reverse order as we want the latest committed revision.
r = re.compile(r"Committed r(?P<svn_revision>\d+)")
for comment in sorted(self.comments(), key=lambda comment: comment['text'], reverse=True):
rev = r.search(comment['text'])
if rev:
return int(rev.group('svn_revision'))

return None
36 changes: 0 additions & 36 deletions Tools/Scripts/webkitpy/common/net/bugzilla/bug_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,39 +45,3 @@ def test_is_in_comments(self):
bugzilla=None)
self.assertTrue(bug.is_in_comments("Message3."))
self.assertFalse(bug.is_in_comments("Message."))

def test_commit_revision(self):
bug = Bug({"comments": []}, bugzilla=None)
self.assertEqual(bug.commit_revision(), None)

bug = Bug({"comments": [
{"text": "Comment 1"},
{"text": "Comment 2"},
]}, bugzilla=None)
self.assertEqual(bug.commit_revision(), None)

bug = Bug({"comments": [
{"text": "Committed r138776: <https://trac.webkit.org/changeset/138776>"},
]}, bugzilla=None)
self.assertEqual(bug.commit_revision(), 138776)

bug = Bug({"comments": [
{"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <https://trac.webkit.org/changeset/138776>"},
]}, bugzilla=None)
self.assertEqual(bug.commit_revision(), 138776)

bug = Bug({"comments": [
{"text": "Comment before"},
{"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <https://trac.webkit.org/changeset/138776>"},
{"text": "Comment after"},
]}, bugzilla=None)
self.assertEqual(bug.commit_revision(), 138776)

bug = Bug({"comments": [
{"text": "Comment before"},
{"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <https://trac.webkit.org/changeset/138776>"},
{"text": "Comment Middle"},
{"text": "(From update of attachment 181280) Clearing flags on attachment: 181280 Committed r138976: <https://trac.webkit.org/changeset/138976>"},
{"text": "Comment After"},
]}, bugzilla=None)
self.assertEqual(bug.commit_revision(), 138976)
Loading

0 comments on commit 7841b27

Please sign in to comment.