Skip to content

Commit

Permalink
Allow users to specify a Bugzilla query URL
Browse files Browse the repository at this point in the history
This allows ultimate flexibility in selecting bugs for synchronization.
Fixes #160.
  • Loading branch information
djmitche committed Dec 11, 2014
1 parent fe1e155 commit 014f5b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
6 changes: 6 additions & 0 deletions bugwarrior/docs/services/bugzilla.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ There is an option to ignore bugs that you are only cc'd on::
But this will continue to include bugs that you reported, regardless of
whether they are assigned to you.

If the filtering options are not sufficient to find the set of bugs you'd like,
you can tell Bugwarrior exactly which bugs to sync by pasting a full query URL
from your browser into the ``bugzilla.query_url`` option::

bugzilla.query_url = https://bugzilla.mozilla.org/query.cgi?bug_status=ASSIGNED&email1=myname%40mozilla.com&emailassigned_to1=1&emailtype1=exact

Provided UDA Fields
-------------------

Expand Down
28 changes: 17 additions & 11 deletions bugwarrior/services/bz.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def __init__(self, *args, **kw):
self.password = self.config_get('password')
self.ignore_cc = self.config_get_default('ignore_cc', default=False,
to_type=lambda x: x == "True")
self.query_url = self.config_get_default('query_url', default=None)

# So more modern bugzilla's require that we specify
# query_format=advanced along with the xmlrpc request.
# https://bugzilla.redhat.com/show_bug.cgi?id=825370
Expand Down Expand Up @@ -168,18 +170,22 @@ def issues(self):
email = self.username
# TODO -- doing something with blockedby would be nice.

query = dict(
column_list=self.COLUMN_LIST,
bug_status=self.OPEN_STATUSES,
email1=email,
emailreporter1=1,
emailassigned_to1=1,
emailqa_contact1=1,
emailtype1="substring",
)
if self.query_url:
query = self.bz.url_to_query(self.query_url)
query['column_list'] = self.COLUMN_LIST
else:
query = dict(
column_list=self.COLUMN_LIST,
bug_status=self.OPEN_STATUSES,
email1=email,
emailreporter1=1,
emailassigned_to1=1,
emailqa_contact1=1,
emailtype1="substring",
)

if not self.ignore_cc:
query['emailcc1'] = 1
if not self.ignore_cc:
query['emailcc1'] = 1

if self.advanced:
# Required for new bugzilla
Expand Down

0 comments on commit 014f5b6

Please sign in to comment.