Changeset 51595 in webkit


Ignore:
Timestamp:
Dec 2, 2009 2:44:28 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-02 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

REGRESSION(51590): style-queue and build-queue think their empty when they are not
https://bugs.webkit.org/show_bug.cgi?id=32061

  • Scripts/modules/bugzilla.py: make all id lookups return ints instead of strings.
  • Scripts/modules/bugzilla_unittest.py: Add and update unit tests to use ints.
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r51593 r51595  
     12009-12-02  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        REGRESSION(51590): style-queue and build-queue think their empty when they are not
     6        https://bugs.webkit.org/show_bug.cgi?id=32061
     7
     8        * Scripts/modules/bugzilla.py: make all id lookups return ints instead of strings.
     9        * Scripts/modules/bugzilla_unittest.py: Add and update unit tests to use ints.
     10
    1112009-12-02  Eric Seidel  <eric@webkit.org>
    212
  • trunk/WebKitTools/Scripts/modules/bugzilla.py

    r51590 r51595  
    9696    match = re.search("http\://webkit\.org/b/(?P<bug_id>\d+)", message)
    9797    if match:
    98         return match.group('bug_id')
     98        return int(match.group('bug_id'))
    9999    match = re.search(Bugzilla.bug_server_regex + "show_bug\.cgi\?id=(?P<bug_id>\d+)", message)
    100100    if match:
    101         return match.group('bug_id')
     101        return int(match.group('bug_id'))
    102102    return None
    103103
     
    174174        attachment['is_obsolete'] = (element.has_key('isobsolete') and element['isobsolete'] == "1")
    175175        attachment['is_patch'] = (element.has_key('ispatch') and element['ispatch'] == "1")
    176         attachment['id'] = str(element.find('attachid').string)
     176        attachment['id'] = int(element.find('attachid').string)
    177177        attachment['url'] = self.attachment_url_for_id(attachment['id'])
    178178        attachment['name'] = unicode(element.find('desc').string)
     
    218218        attachments = self.fetch_attachments_from_bug(bug_id)
    219219        for attachment in attachments:
    220             if attachment['id'] == attachment_id:
     220            # FIXME: Once we have a real Attachment class we shouldn't paper over this possible comparison failure
     221            # and we should remove the int() == int() hacks and leave it just ==.
     222            if int(attachment['id']) == int(attachment_id):
    221223                self._validate_committer_and_reviewer(attachment)
    222224                return attachment
  • trunk/WebKitTools/Scripts/modules/bugzilla_unittest.py

    r51464 r51595  
    3030
    3131from modules.committers import CommitterList, Reviewer, Committer
    32 from modules.bugzilla import Bugzilla
     32from modules.bugzilla import Bugzilla, parse_bug_id
    3333
    3434from modules.BeautifulSoup import BeautifulSoup
     
    6262'''
    6363    _expected_example_attachment_parsing = {
    64         'bug_id' : "100",
     64        'bug_id' : 100,
    6565        'is_obsolete' : True,
    6666        'is_patch' : True,
    67         'id' : "33721",
     67        'id' : 33721,
    6868        'url' : "https://bugs.webkit.org/attachment.cgi?id=33721",
    6969        'name' : "Fixed whitespace issue",
     
    7474        'committer_email' : 'two@test.com',
    7575    }
     76
     77    def test_parse_bug_id(self):
     78        # FIXME: These would be all better as doctests
     79        bugs = Bugzilla()
     80        self.assertEquals(12345, parse_bug_id("http://webkit.org/b/12345"))
     81        self.assertEquals(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345"))
     82        self.assertEquals(12345, parse_bug_id(bugs.short_bug_url_for_bug_id(12345)))
     83        self.assertEquals(12345, parse_bug_id(bugs.bug_url_for_bug_id(12345)))
     84        self.assertEquals(12345, parse_bug_id(bugs.bug_url_for_bug_id(12345, xml=True)))
     85
     86        # Our bug parser is super-fragile, but at least we're testing it.
     87        self.assertEquals(None, parse_bug_id("http://www.webkit.org/b/12345"))
     88        self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345"))
     89
    7690
    7791    def test_attachment_parsing(self):
Note: See TracChangeset for help on using the changeset viewer.