def GetBugNumbers(buildrequests): """Look through a list of buildrequests and return bug number(s) from the change comments""" bugs = [] #log.debug("BUILDREQUESTS: %s" % buildrequests) for key,value in buildrequests.items(): br = value.to_dict() # If we've gotten a bug number we can stop if bugs == []: for comment in br['comments']: if bugs == []: bugs = bz_utils.bugs_from_comments(comment) else: log.debug("Got bug(s) already BUG: %s" % bugs) break return bugs
def testGetBugFromComments(self): message = "try: -b do -p linux,linuxqt,linux64,macosx64,win32,macosx -u reftest,crashtest,mochitests -t none --post-to-bugzilla b664095" bugs = bz_utils.bugs_from_comments(message) self.assertEquals(bugs, [664095])