def _post_error_and_check_for_bug_url(tool, nicks_string, exception): tool.irc().post("%s" % exception) bug_id = parse_bug_id(exception.output) if bug_id: bug_url = tool.bugs.bug_url_for_bug_id(bug_id) tool.irc().post("%s: Ugg... Might have created %s" % (nicks_string, bug_url))
def post_rollout_patch(self, svn_revision_list, rollout_reason): # Ensure that svn revisions are numbers (and not options to # create-rollout). try: svn_revisions = " ".join( [str(int(revision)) for revision in svn_revision_list]) except: raise ScriptError(message="Invalid svn revision number \"%s\"." % " ".join(svn_revision_list)) if rollout_reason.startswith("-"): raise ScriptError(message="The rollout reason may not begin " "with - (\"%s\")." % rollout_reason) output = self._sheriffbot.run_webkit_patch([ "create-rollout", "--force-clean", # In principle, we should pass --non-interactive here, but it # turns out that create-rollout doesn't need it yet. We can't # pass it prophylactically because we reject unrecognized command # line switches. "--parent-command=sheriff-bot", svn_revisions, rollout_reason, ]) return parse_bug_id(output)
def post_rollout_patch(self, svn_revision_list, rollout_reason): # Ensure that svn revisions are numbers (and not options to # create-rollout). try: svn_revisions = " ".join([str(int(revision)) for revision in svn_revision_list]) except: raise ScriptError(message="Invalid svn revision number \"%s\"." % " ".join(svn_revision_list)) if rollout_reason.startswith("-"): raise ScriptError(message="The rollout reason may not begin " "with - (\"%s\")." % rollout_reason) output = self._sheriffbot.run_webkit_patch([ "create-rollout", "--force-clean", # In principle, we should pass --non-interactive here, but it # turns out that create-rollout doesn't need it yet. We can't # pass it prophylactically because we reject unrecognized command # line switches. "--parent-command=sheriff-bot", svn_revisions, rollout_reason, ]) return parse_bug_id(output)
def post_chromium_deps_roll(self, revision): args = [ "post-chromium-deps-roll", "--force-clean", "--non-interactive", "--parent-command=sheriff-bot", ] if revision: args += [revision] output = self._sheriffbot.run_webkit_patch(args) return parse_bug_id(output)
def post_chromium_deps_roll(self, revision, revision_name): args = [ "post-chromium-deps-roll", "--force-clean", "--non-interactive", "--parent-command=sheriff-bot", ] # revision can be None, but revision_name is always something meaningful. args += [revision, revision_name] output = self._sheriffbot.run_webkit_patch(args) return parse_bug_id(output)
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"))