49 if not config.has_section(opts['filter']): |
49 if not config.has_section(opts['filter']): |
50 ui.warning('No filter %s defined\n', opts['filter']) |
50 ui.warning('No filter %s defined\n', opts['filter']) |
51 else: |
51 else: |
52 properties += config.items(opts['filter']) |
52 properties += config.items(opts['filter']) |
53 |
53 |
54 properties += _get_properties(opts['property']) |
54 cmd_properties = _get_properties(opts['property']) |
|
55 list_properties = [p[0] for p in cmd_properties if len(p) == 1] |
|
56 list_properties_dict = {} |
|
57 properties += filter(lambda p: len(p) > 1, cmd_properties) |
55 |
58 |
56 for issue in issues: |
59 for issue in issues: |
57 mbox = mailbox.Maildir(issue, factory=mailbox.MaildirMessage) |
60 mbox = mailbox.Maildir(issue, factory=mailbox.MaildirMessage) |
58 root = _find_root_key(mbox) |
61 root = _find_root_key(mbox) |
59 property_match = True |
62 property_match = True |
60 for property,value in properties: |
63 for property,value in properties: |
61 property_match = property_match and (mbox[root][property] == value) |
64 if value: |
|
65 property_match = property_match and (mbox[root][property] == value) |
|
66 else: |
|
67 property_match = property_match and (property not in mbox[root]) |
|
68 |
62 if not show_all and (not properties or not property_match) and (properties or mbox[root]['State'].upper() in [f.upper() for f in state['fixed']]): continue |
69 if not show_all and (not properties or not property_match) and (properties or mbox[root]['State'].upper() in [f.upper() for f in state['fixed']]): continue |
63 |
|
64 |
|
65 if match_date and not date_match(util.parsedate(mbox[root]['date'])[0]): continue |
70 if match_date and not date_match(util.parsedate(mbox[root]['date'])[0]): continue |
66 ui.write("%s (%3d) [%s]: %s\n" % (issue[len(issues_path)+1:], # +1 for trailing / |
71 |
67 len(mbox)-1, # number of replies (-1 for self) |
72 if not list_properties: |
68 _status_msg(mbox[root]), |
73 ui.write("%s (%3d) [%s]: %s\n" % (issue[len(issues_path)+1:], # +1 for trailing / |
69 mbox[root]['Subject'])) |
74 len(mbox)-1, # number of replies (-1 for self) |
|
75 _status_msg(mbox[root]), |
|
76 mbox[root]['Subject'])) |
|
77 else: |
|
78 for lp in list_properties: |
|
79 if lp in mbox[root]: list_properties_dict.setdefault(lp, set()).add(mbox[root][lp]) |
|
80 |
|
81 if list_properties: |
|
82 for lp in list_properties_dict.keys(): |
|
83 ui.write("%s:\n" % lp) |
|
84 for value in sorted(list_properties_dict[lp]): |
|
85 ui.write(" %s\n" % value) |
70 |
86 |
71 |
87 |
72 def iadd(ui, repo, id = None, comment = 0, **opts): |
88 def iadd(ui, repo, id = None, comment = 0, **opts): |
73 """Adds a new issue, or comment to an existing issue ID or its comment COMMENT""" |
89 """Adds a new issue, or comment to an existing issue ID or its comment COMMENT""" |
74 |
90 |
362 cmdtable = { |
378 cmdtable = { |
363 'ilist': (ilist, |
379 'ilist': (ilist, |
364 [('a', 'all', False, |
380 [('a', 'all', False, |
365 'list all issues (by default only those with state new)'), |
381 'list all issues (by default only those with state new)'), |
366 ('p', 'property', [], |
382 ('p', 'property', [], |
367 'list issues with specific field values (e.g., -p state=fixed)'), |
383 'list issues with specific field values (e.g., -p state=fixed); lists all possible values of a property if no = sign'), |
368 ('d', 'date', '', 'restrict to issues matching the date (e.g., -d ">12/28/2007)"'), |
384 ('d', 'date', '', 'restrict to issues matching the date (e.g., -d ">12/28/2007)"'), |
369 ('f', 'filter', '', 'restrict to pre-defined filter (in %s/%s*)' % (issues_dir, filter_prefix))], |
385 ('f', 'filter', '', 'restrict to pre-defined filter (in %s/%s*)' % (issues_dir, filter_prefix))], |
370 _('hg ilist [OPTIONS]')), |
386 _('hg ilist [OPTIONS]')), |
371 'iadd': (iadd, |
387 'iadd': (iadd, |
372 [('a', 'attach', [], |
388 [('a', 'attach', [], |