Skip to content

Commit f535954

Browse files
committed
cli: Add --comment-tag option
This seems to be a bugzilla5 extension, although redhat's instance doesn't seem to support it yet Resolves: #62
1 parent f459466 commit f535954

5 files changed

Lines changed: 19 additions & 5 deletions

File tree

bugzilla.1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Component name
6767
Bug summary
6868
.IP "--comment=DESCRIPTION, -l DESCRIPTION"
6969
Set initial bug comment/description
70+
.IP "--comment-tag=TAG"
71+
Comment tag for the new comment
7072
.IP "--sub-component=SUB_COMPONENT"
7173
RHBZ sub component name
7274
.IP "--os=OS, -o OS"

bugzilla/_cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ def _parser_add_bz_fields(rootp, command):
214214
p.add_argument('-c', '--component', help="Component name")
215215
p.add_argument('-t', '--summary', '--short_desc', help="Bug summary")
216216
p.add_argument('-l', '--comment', '--long_desc', help=comment_help)
217+
if not cmd_query:
218+
p.add_argument("--comment-tag", action="append",
219+
help="Comment tag for the new comment")
217220
p.add_argument("--sub-component", action="append",
218221
help="RHBZ sub component field")
219222
p.add_argument('-o', '--os', help="Operating system")
@@ -779,6 +782,7 @@ def parse_multi(val):
779782
qa_contact=opt.qa_contact or None,
780783
sub_component=opt.sub_component or None,
781784
alias=opt.alias or None,
785+
comment_tags=opt.comment_tag or None,
782786
)
783787

784788
_merge_field_opts(ret, opt, parser)
@@ -864,6 +868,7 @@ def _do_modify(bz, parser, opt):
864868
sub_component=opt.sub_component or None,
865869
alias=opt.alias or None,
866870
flags=flags or None,
871+
comment_tags=opt.comment_tag or None,
867872
)
868873

869874
# We make this a little convoluted to facilitate unit testing

bugzilla/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,8 @@ def build_update(self,
13381338
devel_whiteboard=None,
13391339
internal_whiteboard=None,
13401340
sub_component=None,
1341-
flags=None):
1341+
flags=None,
1342+
comment_tags=None):
13421343
"""
13431344
Returns a python dict() with properly formatted parameters to
13441345
pass to update_bugs(). See bugzilla documentation for the format
@@ -1414,6 +1415,7 @@ def c(val):
14141415
s("whiteboard", whiteboard)
14151416
s("work_time", work_time, float)
14161417
s("flags", flags)
1418+
s("comment_tags", comment_tags, self._listify)
14171419

14181420
add_dict("blocks", blocks_add, blocks_remove, blocks_set,
14191421
convert=int)
@@ -1601,7 +1603,8 @@ def build_createbug(self,
16011603
target_release=None,
16021604
url=None,
16031605
sub_component=None,
1604-
alias=None):
1606+
alias=None,
1607+
comment_tags=None):
16051608
""""
16061609
Returns a python dict() with properly formatted parameters to
16071610
pass to createbug(). See bugzilla documentation for the format
@@ -1635,7 +1638,7 @@ def build_createbug(self,
16351638
target_milestone=target_milestone,
16361639
target_release=target_release, url=url,
16371640
assigned_to=assigned_to, sub_component=sub_component,
1638-
alias=alias)
1641+
alias=alias, comment_tags=comment_tags)
16391642

16401643
ret.update(localdict)
16411644
return ret

tests/createbug.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ def testSeverity(self):
5959
)
6060

6161
def testMisc(self):
62-
self.clicomm(
63-
"--alias some-alias",
62+
self.clicomm("--alias some-alias",
6463
{"alias": "some-alias"}
6564
)
65+
self.clicomm("--comment 'foo bar' --comment-tag tag1 "
66+
"--comment-tag tag2",
67+
{'comment_tags': ['tag1', 'tag2'], 'description': 'foo bar'})
6668

6769
def testMultiOpts(self):
6870
# Test all opts that can take lists

tests/modify.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def testMisc(self):
139139
"--alias some-alias",
140140
{"alias": "some-alias"}
141141
)
142+
self.clicomm("--comment 'foo bar' --comment-tag tag1 ",
143+
{'comment': {'comment': 'foo bar'}, 'comment_tags': ['tag1']})
142144

143145

144146
def testField(self):

0 commit comments

Comments
 (0)