EWS fails to parse_bug_id_from_attachment_page after bugzilla upgrade
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Mar 2017 00:45:15 +0000 (00:45 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Mar 2017 00:45:15 +0000 (00:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169937
<rdar://problem/31181859>

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla._parse_bug_id_from_attachment_page): Since rel tag is no longer present, parsing the bug id from bug_title.
* Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py: Fixed unit test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214238 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py

index 52002e5..4b3df6e 100644 (file)
@@ -1,5 +1,17 @@
 2017-03-21  Aakash Jain  <aakash_jain@apple.com>
 
+        EWS fails to parse_bug_id_from_attachment_page after bugzilla upgrade
+        https://bugs.webkit.org/show_bug.cgi?id=169937
+        <rdar://problem/31181859>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla._parse_bug_id_from_attachment_page): Since rel tag is no longer present, parsing the bug id from bug_title. 
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py: Fixed unit test.
+
+2017-03-21  Aakash Jain  <aakash_jain@apple.com>
+
         ews should indicate in logs when it fails to parse_bug_id_from_attachment_page
         https://bugs.webkit.org/show_bug.cgi?id=169927
 
index b600054..d1e6b69 100644 (file)
@@ -486,11 +486,14 @@ class Bugzilla(object):
 
     def _parse_bug_id_from_attachment_page(self, page):
         # The "Up" relation happens to point to the bug.
-        up_link = BeautifulSoup(page).find('link', rel='Up')
-        if not up_link:
+        title = BeautifulSoup(page).find('div', attrs={'id':'bug_title'})
+        if not title :
             _log.warning("This attachment does not exist (or you don't have permissions to view it).")
             return None
-        match = re.search("show_bug.cgi\?id=(?P<bug_id>\d+)", up_link['href'])
+        match = re.search("show_bug.cgi\?id=(?P<bug_id>\d+)", str(title))
+        if not match:
+            _log.warning("Unable to parse bug id from attachment")
+            return None
         return int(match.group('bug_id'))
 
     def bug_id_for_attachment_id(self, attachment_id):
index 57aa90f..09402b2 100644 (file)
@@ -238,8 +238,9 @@ Ignore this bug.  Just for testing failure modes of webkit-patch and the commit-
   <head>
     <title>
   Attachment 41073 Details for Bug 27314</title>
-<link rel="Top" href="https://bugs.webkit.org/">
-    <link rel="Up" href="show_bug.cgi?id=27314">
+<div id="bug_title">
+  Attachment 41073 Details for
+  <a class="bz_bug_link bz_status_ASSIGNED " title="Sample bug" href="show_bug.cgi?id=27314">Bug 27314</a>: Sample bug</div>
 """
 
     def test_attachment_detail_bug_parsing(self):