scripts/dumpbz | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-)
New commits: commit 41203640aa2c43c6cce689df70aa702d75b43c41 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Thu Mar 27 21:50:15 2014 +0100 add aoo tracker Change-Id: I7b57f81722c48d7ed36268c2dab4caa59e306f0f diff --git a/scripts/dumpbz b/scripts/dumpbz index 75a402b..e0a4639 100755 --- a/scripts/dumpbz +++ b/scripts/dumpbz @@ -155,6 +155,35 @@ class FdoBugzillaWrapper: opener = urllib.request.urlopen(FdoBugzillaWrapper.FDOBZ + FdoBugzillaWrapper.BUGXMLQUERY % int(bug_id)) return str(opener.read(), encoding='utf8') +class AooBugzillaWrapper: + AOOBZ='https://issues.apache.org/ooo/' + BATCHQUERY = 'buglist.cgi?query_format=advanced&ctype=csv&f1=bug_id&columnlist=bug_id&o1=greaterthan&v1=%d&product=LibreOffice&limit=%d&order=bug_id' + CHANGEDQUERY = 'buglist.cgi?query_format=advanced&ctype=csv&f1=bug_id&columnlist=bug_id&chfieldto=Now&chfieldfrom=%s&product=LibreOffice' + UNRESOLVEDONLY='&resolution=---' + BUGXMLQUERY = 'show_bug.cgi?ctype=xml&id=%d' + def __batch_buglist_url(self, offset, limit, unresolved_only): + url = FdoBugzillaWrapper.FDOBZ + FdoBugzillaWrapper.BATCHQUERY % (offset, limit) + if unresolved_only: + url += FdoBugzillaWrapper.UNRESOLVEDONLY + return url + def __changed_buglist_url(self, since): + url = FdoBugzillaWrapper.FDOBZ + FdoBugzillaWrapper.CHANGEDQUERY % (since) + return url + def __query_bug_list(self, query): + opener = urllib.request.urlopen(query) + bug_ids = str(opener.read(), encoding='utf8') + bug_ids = bug_ids.split('\n')[1:] + return bug_ids + def get_batch_of_bug_ids(self, offset, batchsize, unresolved): + return self.__query_bug_list(self.__batch_buglist_url(int(offset), int(batchsize), unresolved)) + def get_initial_bug_id(self): + return '0' + def get_changed_bug_ids(self, since): + return self.__query_bug_list(self.__changed_buglist_url(since)) + def get_bug_xml(self, bug_id): + opener = urllib.request.urlopen(FdoBugzillaWrapper.FDOBZ + FdoBugzillaWrapper.BUGXMLQUERY % int(bug_id)) + return str(opener.read(), encoding='utf8') + class SyncWorker: def __init__(self, storage, bzwrapper): (self.storage, self.bzwrapper, self.log) = (storage, bzwrapper, None) @@ -345,18 +374,41 @@ class TestFdoBugzillaWrapper(unittest.TestCase): bug_xml = self.fdowrapper.get_bug_xml(10000) self.assertRegex(bug_xml, 'bugzilla version') +class TestAooBugzillaWrapper(unittest.TestCase): + def setUp(self): + self.aoowrapper = AooBugzillaWrapper() + def __check_bug_list(self, bug_ids): + for bug_id in bug_ids: + self.assertGreater(int(bug_id), 0) + def test_get_batch_of_bug_ids(self): + bug_ids = self.aoowrapper.get_batch_of_bug_ids(0, 15, False) + self.assertEqual(len(bug_ids), 15) + self.__check_bug_list(bug_ids) + def test_get_initial_bug_id(self): + bug_id = self.aoowrapper.get_initial_bug_id() + def test_get_changed_bug_ids(self): + bug_ids = self.aoowrapper.get_changed_bug_ids('1d') + self.__check_bug_list(bug_ids) + def test_get_bug_xml(self): + bug_xml = self.aoowrapper.get_bug_xml(10000) + self.assertRegex(bug_xml, 'bugzilla version') + if __name__ == '__main__': parser = optparse.OptionParser() parser.add_option('--selftest', action='store_true', dest='selftest', default=False) parser.add_option('--storage', action='store', dest='storage') parser.add_option('--setup', action='store_true', dest='setup', default=False) + parser.add_option('--tracker', action='store', dest='tracker', default='fdo') (options, args) = parser.parse_args() if options.selftest: unittest.main(argv=[sys.argv[0]]) else: if not options.storage: sys.exit(1) - bzwrapper = FdoBugzillaWrapper() + if options.tracker == 'fdo': + bzwrapper = FdoBugzillaWrapper() + elif options.tracker == 'aoo': + bzwrapper = AooBugzillaWrapper() storage = LocalGitStorage(options.storage) if options.setup: storage.setup() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits