Merge lp:~gz/hydrazine/bugclient_multitag_filter into lp:hydrazine

Proposed by Martin Packman
Status: Merged
Approved by: Martin Packman
Approved revision: 103
Merged at revision: 103
Proposed branch: lp:~gz/hydrazine/bugclient_multitag_filter
Merge into: lp:hydrazine
Diff against target: 44 lines (+12/-1)
1 file modified
bugclient (+12/-1)
To merge this branch: bzr merge lp:~gz/hydrazine/bugclient_multitag_filter
Reviewer Review Type Date Requested Status
Alex Chiang (community) Approve
Review via email: mp+115153@code.launchpad.net

Description of the change

In bugclient 'filter tags a b c' is advertised as working but doesn't, as the api expects a list of tags rather than a string with spaces in. In addition, the api defaults to using "any of the given tags" which makes common things like "has this tag but doesn't have this tag" impossible to do.

This branch fixes how multiple tags are passed, exposes the 'tags_combinator' api parameter to filter, and defaults to using 'All' rather than 'Any'. This isn't the prettiest possible way of accomplishing this, but as launchpad doesn't support more complex boolean operations with tags and the new default should generally be fine anyway, inventing a fancier scheme isn't really needed.

To post a comment you must log in.
Revision history for this message
Alex Chiang (achiang) wrote :

From the help:
filter tags a b c # tags 'a', 'b', and 'c'

That says "list of tags" to me. I agree that boolean 'and' is implicit in there.

But anyway, I think tags_combinator is ok. I'm a little nervous of the increased complexity in this interface, but I'm not sure what to do to fix it, and I don't want to block this fix.

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

Thanks for the review Alex!

I agree the tags_combinator interface isn't very nice, but hopefully it can generally be ignored.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bugclient'
2--- bugclient 2011-10-27 23:17:44 +0000
3+++ bugclient 2012-07-16 14:15:08 +0000
4@@ -43,8 +43,9 @@
5 'Incomplete', 'Invalid', 'New'])
6 importance_enum = NamedEnum(['Critical', 'High', 'Medium', 'Low',
7 'Wishlist', 'Undecided'])
8+tags_combinator_enum = NamedEnum(['Any', 'All'])
9 filter_enum = NamedEnum(['milestone', 'status', 'tags', 'search',
10- 'regexp', 'clear'])
11+ 'regexp', 'clear', 'tags_combinator'])
12
13 class HydrazineCmd(cmd.Cmd):
14
15@@ -85,6 +86,9 @@
16 elif f == "regexp":
17 # Launchpad doesn't understand this; we use it below
18 continue
19+ elif f == "tags":
20+ kwargs['tags'] = self.filters[f].split()
21+ kwargs.setdefault("tags_combinator", "All")
22 else:
23 kwargs[f] = self.filters[f]
24 # XXX: is this the best sort order?
25@@ -185,6 +189,7 @@
26 filter milestone M1 # milestone named 'M1'
27 filter status new # all New bugs
28 filter tags a b c # tags 'a', 'b', and 'c'
29+ filter tags_combinator Any # any of the above tags rather than all
30 filter search <search phrase> # text search: titles, descriptions, etc.
31 filter regexp <python regexp> # regexp search on bug titles only
32 filter clear # remove all filters
33@@ -215,6 +220,12 @@
34 except re.error, e:
35 print "regexp error: %s" % e
36 return
37+ elif args[0] == "tags_combinator":
38+ val = tags_combinator_enum.get(' '.join(args[1:]))
39+ if val is None:
40+ tags_combinator_enum.show_valid()
41+ return
42+ args[1:] = [val]
43
44 self.filters[args[0]] = ' '.join(args[1:])
45

Subscribers

People subscribed via source and target branches

to all changes: