def test_parse_attachment_id(self): self.assertEqual( 12345, parse_attachment_id( "https://bugs.webkit.org/attachment.cgi?id=12345&action=review" )) self.assertEqual( 12345, parse_attachment_id( "https://bugs.webkit.org/attachment.cgi?id=12345&action=edit")) self.assertEqual( 12345, parse_attachment_id( "https://bugs.webkit.org/attachment.cgi?id=12345&action=prettypatch" )) self.assertEqual( 12345, parse_attachment_id( "https://bugs.webkit.org/attachment.cgi?id=12345&action=diff")) # Direct attachment links are hosted from per-bug subdomains: self.assertEqual( 12345, parse_attachment_id( "https://bug-23456-attachments.webkit.org/attachment.cgi?id=12345" )) # Make sure secure attachment URLs work too. self.assertEqual( 12345, parse_attachment_id( "https://bug-23456-attachments.webkit.org/attachment.cgi?id=12345&t=Bqnsdkl9fs" ))
def _fetch_list_of_patches_to_process(self, options, args, tool): all_patches = [] for url in args: bug_id = urls.parse_bug_id(url) if bug_id: patches = tool.bugs.fetch_bug(bug_id).patches() _log.info("%s found on bug %s." % (pluralize("patch", len(patches)), bug_id)) all_patches += patches attachment_id = urls.parse_attachment_id(url) if attachment_id: all_patches += tool.bugs.fetch_attachment(attachment_id) return all_patches