Skip to content

Commit

Permalink
Merge pull request #226 from ryansb/feature/moarBugzillaStatus
Browse files Browse the repository at this point in the history
Add BZ status features
  • Loading branch information
ralphbean committed Jul 27, 2015
2 parents 156b5a9 + 6411e48 commit 90c81db
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
9 changes: 9 additions & 0 deletions bugwarrior/docs/services/bugzilla.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ 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 your bugzilla "actionable" bugs only include ON_QA, FAILS_QA, PASSES_QA, and POST::

bugzilla.open_statuses = ON_QA,FAILS_QA,PASSES_QA,POST

This won't create tasks for bugs in other states. The default open statuses:
"NEW,ASSIGNED,NEEDINFO,ON_DEV,MODIFIED,POST,REOPENED,ON_QA,FAILS_QA,PASSES_QA"

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::
Expand All @@ -57,3 +64,5 @@ Provided UDA Fields
+---------------------+---------------------+---------------------+
| ``bugzillabugid`` | Bug ID | Numeric (integer) |
+---------------------+---------------------+---------------------+
| ``bugzillastatus`` | Bugzilla Status | Text (string) |
+---------------------+---------------------+---------------------+
38 changes: 25 additions & 13 deletions bugwarrior/services/bz.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class BugzillaIssue(Issue):
URL = 'bugzillaurl'
SUMMARY = 'bugzillasummary'
BUG_ID = 'bugzillabugid'
STATUS = 'bugzillastatus'

UDAS = {
URL: {
Expand All @@ -21,6 +22,10 @@ class BugzillaIssue(Issue):
'type': 'string',
'label': 'Bugzilla Summary',
},
STATUS: {
'type': 'string',
'label': 'Bugzilla Status',
},
BUG_ID: {
'type': 'numeric',
'label': 'Bugzilla Bug ID',
Expand All @@ -45,6 +50,7 @@ def to_taskwarrior(self):
self.URL: self.extra['url'],
self.SUMMARY: self.record['summary'],
self.BUG_ID: self.record['id'],
self.STATUS: self.record['status'],
}

def get_default_description(self):
Expand All @@ -56,24 +62,27 @@ def get_default_description(self):
)


_open_statuses = [
'NEW',
'ASSIGNED',
'NEEDINFO',
'ON_DEV',
'MODIFIED',
'POST',
'REOPENED',
'ON_QA',
'FAILS_QA',
'PASSES_QA',
]


class BugzillaService(IssueService):
ISSUE_CLASS = BugzillaIssue
CONFIG_PREFIX = 'bugzilla'

OPEN_STATUSES = [
'NEW',
'ASSIGNED',
'NEEDINFO',
'ON_DEV',
'MODIFIED',
'POST',
'REOPENED',
'ON_QA',
'FAILS_QA',
'PASSES_QA',
]
COLUMN_LIST = [
'id',
'status',
'summary',
'priority',
'component',
Expand All @@ -88,6 +97,9 @@ def __init__(self, *args, **kw):
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)
self.open_statuses = self.config_get_default(
'open_statuses', _open_statuses, to_type=lambda x: x.split(','))
log.name(self.target).debug(" filtering on statuses: {0}", self.open_statuses)

# So more modern bugzilla's require that we specify
# query_format=advanced along with the xmlrpc request.
Expand Down Expand Up @@ -176,7 +188,7 @@ def issues(self):
else:
query = dict(
column_list=self.COLUMN_LIST,
bug_status=self.OPEN_STATUSES,
bug_status=self.open_statuses,
email1=email,
emailreporter1=1,
emailassigned_to1=1,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test_to_taskwarrior(self):
arbitrary_record = {
'component': 'Something',
'priority': 'urgent',
'status': 'NEW',
'summary': 'This is the issue summary',
'id': 1234567,
}
Expand All @@ -40,6 +41,7 @@ def test_to_taskwarrior(self):
'priority': issue.PRIORITY_MAP[arbitrary_record['priority']],
'annotations': arbitrary_extra['annotations'],

issue.STATUS: arbitrary_record['status'],
issue.URL: arbitrary_extra['url'],
issue.SUMMARY: arbitrary_record['summary'],
issue.BUG_ID: arbitrary_record['id']
Expand Down

0 comments on commit 90c81db

Please sign in to comment.