~maxb/hydrazine/lp-delete-ppa-packages

« back to all changes in this revision

Viewing changes to bugclient

  • Committer: Martin Packman
  • Date: 2012-07-24 10:48:09 UTC
  • mfrom: (102.1.1 hydrazine)
  • Revision ID: martin.packman@canonical.com-20120724104809-4vgb8zxsr6ohjiuw
Support filtering on multiple tags in bugclient and expose tags_combinator

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
                           'Incomplete', 'Invalid', 'New'])
44
44
importance_enum = NamedEnum(['Critical', 'High', 'Medium', 'Low',
45
45
                              'Wishlist', 'Undecided'])
 
46
tags_combinator_enum = NamedEnum(['Any', 'All'])
46
47
filter_enum = NamedEnum(['milestone', 'status', 'tags', 'search',
47
 
                         'regexp', 'clear'])
 
48
                         'regexp', 'clear', 'tags_combinator'])
48
49
 
49
50
class HydrazineCmd(cmd.Cmd):
50
51
 
85
86
            elif f == "regexp":
86
87
                # Launchpad doesn't understand this; we use it below
87
88
                continue
 
89
            elif f == "tags":
 
90
                kwargs['tags'] = self.filters[f].split()
 
91
                kwargs.setdefault("tags_combinator", "All")
88
92
            else:
89
93
                kwargs[f] = self.filters[f]
90
94
        # XXX: is this the best sort order?
185
189
    filter milestone M1                # milestone named 'M1'
186
190
    filter status new                  # all New bugs
187
191
    filter tags a b c                  # tags 'a', 'b', and 'c'
 
192
    filter tags_combinator Any         # any of the above tags rather than all
188
193
    filter search <search phrase>      # text search: titles, descriptions, etc.
189
194
    filter regexp <python regexp>      # regexp search on bug titles only
190
195
    filter clear                       # remove all filters
215
220
            except re.error, e:
216
221
                print "regexp error: %s" % e
217
222
                return
 
223
        elif args[0] == "tags_combinator":
 
224
            val = tags_combinator_enum.get(' '.join(args[1:]))
 
225
            if val is None:
 
226
                tags_combinator_enum.show_valid()
 
227
                return
 
228
            args[1:] = [val]
218
229
 
219
230
        self.filters[args[0]] = ' '.join(args[1:])
220
231