summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
commitcd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch)
tree8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
parentd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff)
downloadqtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py')
-rw-r--r--Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py70
1 files changed, 15 insertions, 55 deletions
diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
index 511f1bbdb..a32e86e13 100644
--- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
+++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
@@ -259,20 +259,26 @@ class BugzillaQueries(object):
class Bugzilla(object):
- def __init__(self, dryrun=False, committers=committers.CommitterList()):
- self.dryrun = dryrun
+ def __init__(self, committers=committers.CommitterList()):
self.authenticated = False
self.queries = BugzillaQueries(self)
self.committers = committers
self.cached_quips = []
self.edit_user_parser = EditUsersParser()
+ self._browser = None
- # FIXME: We should use some sort of Browser mock object when in dryrun
- # mode (to prevent any mistakes).
- from webkitpy.thirdparty.autoinstalled.mechanize import Browser
- self.browser = Browser()
- # Ignore bugs.webkit.org/robots.txt until we fix it to allow this script.
- self.browser.set_handle_robots(False)
+ def _get_browser(self):
+ if not self._browser:
+ from webkitpy.thirdparty.autoinstalled.mechanize import Browser
+ self._browser = Browser()
+ # Ignore bugs.webkit.org/robots.txt until we fix it to allow this script.
+ self._browser.set_handle_robots(False)
+ return self._browser
+
+ def _set_browser(self, value):
+ self._browser = value
+
+ browser = property(_get_browser, _set_browser)
def fetch_user(self, user_id):
self.authenticate()
@@ -291,7 +297,7 @@ class Bugzilla(object):
def quips(self):
# We only fetch and parse the list of quips once per instantiation
# so that we do not burden bugs.webkit.org.
- if not self.cached_quips and not self.dryrun:
+ if not self.cached_quips:
self.cached_quips = self.queries.fetch_quips()
return self.cached_quips
@@ -475,11 +481,6 @@ class Bugzilla(object):
if self.authenticated:
return
- if self.dryrun:
- log("Skipping log in for dry run...")
- self.authenticated = True
- return
-
credentials = Credentials(config_urls.bug_server_host, git_prefix="bugzilla")
attempts = 0
@@ -563,10 +564,6 @@ class Bugzilla(object):
comment_text=None):
self.authenticate()
log('Adding attachment "%s" to %s' % (description, self.bug_url_for_bug_id(bug_id)))
- if self.dryrun:
- log(comment_text)
- return
-
self.browser.open(self.add_attachment_url(bug_id))
self.browser.select_form(name="entryform")
file_object = self._file_object_for_upload(file_or_string)
@@ -590,10 +587,6 @@ class Bugzilla(object):
self.authenticate()
log('Adding patch "%s" to %s' % (description, self.bug_url_for_bug_id(bug_id)))
- if self.dryrun:
- log(comment_text)
- return
-
self.browser.open(self.add_attachment_url(bug_id))
self.browser.select_form(name="entryform")
file_object = self._file_object_for_upload(file_or_string)
@@ -644,11 +637,6 @@ class Bugzilla(object):
self.authenticate()
log('Creating bug with title "%s"' % bug_title)
- if self.dryrun:
- log(bug_description)
- # FIXME: This will make some paths fail, as they assume this returns an id.
- return
-
self.browser.open(config_urls.bug_server_url + "enter_bug.cgi?product=WebKit")
self.browser.select_form(name="Create")
component_items = self.browser.find_control('component').items
@@ -706,9 +694,6 @@ class Bugzilla(object):
comment_text += "\n\n%s" % additional_comment_text
log(comment_text)
- if self.dryrun:
- return
-
self.browser.open(self.attachment_url_for_id(attachment_id, 'edit'))
self.browser.select_form(nr=1)
self.browser.set_value(comment_text, name='comment', nr=0)
@@ -732,9 +717,6 @@ class Bugzilla(object):
comment_text += "\n\n%s" % additional_comment_text
log(comment_text)
- if self.dryrun:
- return
-
self.browser.open(self.attachment_url_for_id(attachment_id, 'edit'))
self.browser.select_form(nr=1)
@@ -751,10 +733,6 @@ class Bugzilla(object):
self.authenticate()
log("Obsoleting attachment: %s" % attachment_id)
- if self.dryrun:
- log(comment_text)
- return
-
self.browser.open(self.attachment_url_for_id(attachment_id, 'edit'))
self.browser.select_form(nr=1)
self.browser.find_control('isobsolete').items[0].selected = True
@@ -772,9 +750,6 @@ class Bugzilla(object):
self.authenticate()
log("Adding %s to the CC list for bug %s" % (email_address_list, bug_id))
- if self.dryrun:
- return
-
self.browser.open(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
self.browser["newcc"] = ", ".join(email_address_list)
@@ -784,10 +759,6 @@ class Bugzilla(object):
self.authenticate()
log("Adding comment to bug %s" % bug_id)
- if self.dryrun:
- log(comment_text)
- return
-
self.browser.open(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
self.browser["comment"] = comment_text
@@ -799,10 +770,6 @@ class Bugzilla(object):
self.authenticate()
log("Closing bug %s as fixed" % bug_id)
- if self.dryrun:
- log(comment_text)
- return
-
self.browser.open(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
if comment_text:
@@ -821,10 +788,6 @@ class Bugzilla(object):
assignee = self.username
log("Assigning bug %s to %s" % (bug_id, assignee))
- if self.dryrun:
- log(comment_text)
- return
-
self.browser.open(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
@@ -850,9 +813,6 @@ for someone to add EditBugs to your bugs.webkit.org account.""")
# Bugzilla requires a comment when re-opening a bug, so we know it will
# never be None.
log(comment_text)
- if self.dryrun:
- return
-
self.browser.open(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
bug_status = self.browser.find_control("bug_status", type="select")