--- a/.issues/8e4d2c2d12eb0169 Sat Dec 29 23:19:03 2007 -0500
+++ b/.issues/8e4d2c2d12eb0169 Sun Dec 30 08:38:41 2007 -0500
@@ -1,7 +1,7 @@
From artemis Sat Dec 29 07:57:17 2007
From: Dmitriy Morozov <morozov@cs.duke.edu>
Date: Sat, 29 Dec 2007 02:52:52 EST
-State: new
+State: fixed
Subject: filters
Message-Id: 8e4d2c2d12eb0169-0-artemis@metatron
@@ -18,3 +18,12 @@
Then hg ilist -f critical-1.0 would show only issues with properties
due-in and priority set to 1.0 and critical in the respective headers.
+
+From MAILER-DAEMON Sun Dec 30 13:37:54 2007
+From: Dmitriy Morozov <morozov@cs.duke.edu>
+Date: Sun, 30 Dec 2007 08:37:54 EST
+Subject: properties changes (state)
+Message-Id: 8e4d2c2d12eb0169-1-artemis@metatron
+References: 8e4d2c2d12eb0169-0-artemis@metatron
+
+state=fixed
--- a/artemis.py Sat Dec 29 23:19:03 2007 -0500
+++ b/artemis.py Sun Dec 30 08:38:41 2007 -0500
@@ -4,13 +4,13 @@
from mercurial import hg, util
from mercurial.i18n import _
-import os, time, random, mailbox, glob, socket
+import os, time, random, mailbox, glob, socket, ConfigParser
state = {'new': 'new', 'fixed': 'fixed'}
state['default'] = state['new']
issues_dir = ".issues"
-filter_filename = ".filters"
+filter_prefix = ".filter"
date_format = '%a, %d %b %Y %H:%M:%S %Z'
@@ -19,7 +19,7 @@
# Process options
show_all = opts['all']
- properties = _get_properties(opts['property'])
+ properties = []
date_match = lambda x: True
if opts['date']:
date_match = util.matchdate(opts['date'])
@@ -30,6 +30,18 @@
issues = glob.glob(os.path.join(issues_path, '*'))
+ # Process filter
+ if opts['filter']:
+ filters = glob.glob(os.path.join(issues_path, filter_prefix + '*'))
+ config = ConfigParser.SafeConfigParser()
+ config.read(filters)
+ if not config.has_section(opts['filter']):
+ ui.warning('No filter %s defined\n', opts['filter'])
+ else:
+ properties += config.items(opts['filter'])
+
+ _get_properties(opts['property'])
+
for issue in issues:
mbox = mailbox.mbox(issue)
property_match = True
@@ -238,7 +250,7 @@
('p', 'property', [],
'list issues with specific field values (e.g., -p state=fixed)'),
('d', 'date', '', 'restrict to issues matching the date (e.g., -d ">12/28/2007)"'),
- ('f', 'filter', '', 'restrict to pre-defined filter (in %s/%s)' % (issues_dir, filter_filename))],
+ ('f', 'filter', '', 'restrict to pre-defined filter (in %s/%s*)' % (issues_dir, filter_prefix))],
_('hg ilist [OPTIONS]')),
'iadd': (iadd,
[],