Added #c25 (state annotations)
authorDmitriy Morozov <dmitriy@mrzv.org>
Fri, 15 Apr 2011 22:57:55 -0700
changeset 59 18da6a9fa7b8
parent 58 f44b6f1f2115
child 60 c933fa2cd204
Added #c25 (state annotations)
.issues/c257b7f62fae9087/new/1302933431.M193154P8736Q1.vine
artemis.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/c257b7f62fae9087/new/1302933431.M193154P8736Q1.vine	Fri Apr 15 22:57:55 2011 -0700
@@ -0,0 +1,18 @@
+From: Dmitriy Morozov <dmitriy@mrzv.org>
+Date: Fri, 15 Apr 2011 22:54:20 -0700
+State: new
+Subject: State annotations
+Message-Id: <c257b7f62fae9087-0-artemis@vine>
+
+Make state annotations more generic. Right now, only "resolved" state lists
+the contents of the property resolution, i.e.
+
+  State: resolved
+  resolution: fixed
+
+shows up as
+
+  ... [resolved=fixed] ...
+
+in the issue list. The user should be able to configure this behavior for other
+states as well.
--- a/artemis.py	Fri Apr 15 22:43:19 2011 -0700
+++ b/artemis.py	Fri Apr 15 22:57:55 2011 -0700
@@ -17,8 +17,10 @@
 from    termcolor       import colored
 
 
-state = {'new': 'new', 'fixed': ['fixed', 'resolved']}
-state['default'] = state['new']
+state = { 'new':   ['new'],
+          'fixed': ['fixed', 'resolved'] }
+annotation = { 'resolved': 'resolution' }
+default_state = 'new'
 default_issues_dir = ".issues"
 filter_prefix = ".filter"
 date_format = '%a, %d %b %Y %H:%M:%S %1%2'
@@ -119,7 +121,7 @@
 
     default_issue_text  =         "From: %s\nDate: %s\n" % (user, util.datestr(format = date_format))
     if not id:
-        default_issue_text +=     "State: %s\n" % state['default']
+        default_issue_text +=     "State: %s\n" % default_state
     default_issue_text +=         "Subject: brief description\n\n"
     default_issue_text +=         "Detailed description."
 
@@ -131,7 +133,7 @@
     # Create the text
     if message:
         if not id:
-            state_str = 'State: %s\n' % state['default']
+            state_str = 'State: %s\n' % default_state
         else:
             state_str = ''
         issue = "From: %s\nDate: %s\nSubject: %s\n%s" % \
@@ -417,10 +419,11 @@
     return outer
 
 def _status_msg(msg):
-    if msg['State'] == 'resolved':
-        return 'resolved=' + msg['resolution']
+    s = msg['State']
+    if s in annotation:
+        return '%s=%s' % (s, msg[annotation[s]])
     else:
-        return msg['State']
+        return s
 
 def _read_colors(ui):
     colors = {}