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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51595
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+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.
+
2009-12-02 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
def parse_bug_id(message):
match = re.search("http\://webkit\.org/b/(?P<bug_id>\d+)", message)
if match:
- return match.group('bug_id')
+ return int(match.group('bug_id'))
match = re.search(Bugzilla.bug_server_regex + "show_bug\.cgi\?id=(?P<bug_id>\d+)", message)
if match:
- return match.group('bug_id')
+ return int(match.group('bug_id'))
return None
# FIXME: This should not depend on git for config storage
attachment['bug_id'] = bug_id
attachment['is_obsolete'] = (element.has_key('isobsolete') and element['isobsolete'] == "1")
attachment['is_patch'] = (element.has_key('ispatch') and element['ispatch'] == "1")
- attachment['id'] = str(element.find('attachid').string)
+ attachment['id'] = int(element.find('attachid').string)
attachment['url'] = self.attachment_url_for_id(attachment['id'])
attachment['name'] = unicode(element.find('desc').string)
attachment['type'] = str(element.find('type').string)
return None
attachments = self.fetch_attachments_from_bug(bug_id)
for attachment in attachments:
- if attachment['id'] == attachment_id:
+ # FIXME: Once we have a real Attachment class we shouldn't paper over this possible comparison failure
+ # and we should remove the int() == int() hacks and leave it just ==.
+ if int(attachment['id']) == int(attachment_id):
self._validate_committer_and_reviewer(attachment)
return attachment
return None # This should never be hit.
import unittest
from modules.committers import CommitterList, Reviewer, Committer
-from modules.bugzilla import Bugzilla
+from modules.bugzilla import Bugzilla, parse_bug_id
from modules.BeautifulSoup import BeautifulSoup
</attachment>
'''
_expected_example_attachment_parsing = {
- 'bug_id' : "100",
+ 'bug_id' : 100,
'is_obsolete' : True,
'is_patch' : True,
- 'id' : "33721",
+ 'id' : 33721,
'url' : "https://bugs.webkit.org/attachment.cgi?id=33721",
'name' : "Fixed whitespace issue",
'type' : "text/plain",
'committer_email' : 'two@test.com',
}
+ def test_parse_bug_id(self):
+ # FIXME: These would be all better as doctests
+ bugs = Bugzilla()
+ self.assertEquals(12345, parse_bug_id("http://webkit.org/b/12345"))
+ self.assertEquals(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345"))
+ self.assertEquals(12345, parse_bug_id(bugs.short_bug_url_for_bug_id(12345)))
+ self.assertEquals(12345, parse_bug_id(bugs.bug_url_for_bug_id(12345)))
+ self.assertEquals(12345, parse_bug_id(bugs.bug_url_for_bug_id(12345, xml=True)))
+
+ # Our bug parser is super-fragile, but at least we're testing it.
+ self.assertEquals(None, parse_bug_id("http://www.webkit.org/b/12345"))
+ self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345"))
+
+
def test_attachment_parsing(self):
bugzilla = Bugzilla()