Merged + added documentation for "iadd --message" and "ishow --mutt" + marked c76 as fixed
authorDmitriy Morozov <dmitriy@mrzv.org>
Sat, 16 Jan 2010 11:42:57 -0800
changeset 49 248ec36cef5f
parent 35 2e7575352ef3 (current diff)
parent 48 7897c850150f (diff)
child 50 10fa939a4a3e
Merged + added documentation for "iadd --message" and "ishow --mutt" + marked c76 as fixed
.issues/c768d39702f1ab1b/new/1259362423.M718179P23923Q1.vlan-laptop
.issues/c768d39702f1ab1b/new/1263670850.M923950P21837Q1.vine
README
artemis.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Sat Jan 16 11:42:57 2010 -0800
@@ -0,0 +1,2 @@
+syntax:glob
+*.pyc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/82aa4838dbeb6254/new/1259359374.M75010P29785Q1.vlan-laptop	Sat Jan 16 11:42:57 2010 -0800
@@ -0,0 +1,11 @@
+From: Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
+Date: Sat, 28 Nov 2009 00:45:23
+State: new
+Subject: Results of ilist appear to be unsorted
+Message-Id: <82aa4838dbeb6254-0-artemis@vlan-laptop>
+
+I guess the results of `hg ilist` are listed in the same order as issues'
+directory names returned by `glob.glob`.
+
+I think that sorting issues by modification or creation date makes more sense.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/c768d39702f1ab1b/new/1259362423.M718179P23923Q1.vlan-laptop	Sat Jan 16 11:42:57 2010 -0800
@@ -0,0 +1,14 @@
+From: Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
+Date: Sat, 28 Nov 2009 01:45:30
+State: resolved
+Subject: Add --mutt to ilist
+Message-Id: <c768d39702f1ab1b-0-artemis@vlan-laptop>
+To: Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
+resolution: fixed
+
+It would be nice to see a list of selected issues (e. g. via `ilist -f`) as a
+list of regular email threads in `mutt`.
+
+One way to implement this is to create a new Maildir of temporary symbolic links
+to all the issue files being selected via `ilist`.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/c768d39702f1ab1b/new/1259367261.M909516P29149Q1.vlan-laptop	Sat Jan 16 11:42:57 2010 -0800
@@ -0,0 +1,7 @@
+From: Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
+Date: Sat, 28 Nov 2009 03:14:21
+Subject: changed properties (To=Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>, State=accepted)
+Message-Id: <c768d39702f1ab1b-827a5ca516fbb486-artemis@vlan-laptop>
+References: <c768d39702f1ab1b-0-artemis@vlan-laptop>
+In-Reply-To: <c768d39702f1ab1b-0-artemis@vlan-laptop>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/c768d39702f1ab1b/new/1263670850.M923950P21837Q1.vine	Sat Jan 16 11:42:57 2010 -0800
@@ -0,0 +1,7 @@
+From: Dmitriy Morozov <dmitriy@mrzv.org>
+Date: Sat, 16 Jan 2010 11:40:50
+Subject: changed properties (state=resolved, resolution=fixed)
+Message-Id: <c768d39702f1ab1b-ae3bc4e3d26a5f36-artemis@vine>
+References: <c768d39702f1ab1b-0-artemis@vlan-laptop>
+In-Reply-To: <c768d39702f1ab1b-0-artemis@vlan-laptop>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/cec60e25154133d3/new/1259365663.M969393P10754Q1.vlan-laptop	Sat Jan 16 11:42:57 2010 -0800
@@ -0,0 +1,30 @@
+From: Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
+Date: Sat, 28 Nov 2009 02:30:08
+State: new
+Subject: Add more filter expressions: ~=, !=, !~=
+Message-Id: <cec60e25154133d3-0-artemis@vlan-laptop>
+
+At this moment only exact `=` is supported in filters.
+
+I propose adding the following constructs:
+
+* `~=` for "contains"
+* `!~=` for "does not contain"
+* `!=` for "is not equal to"
+
+Some examples of filters that use these constructs are provided below.
+
+All the tickes by John Smith that are not fixed:
+
+    $ hg ilist -p from~=Smith -p state!=fixed
+
+All the tickets of John Smith by specifying his email:
+
+    $ hg ilist -p to=~smith@example.com
+
+All the tickets of high priority (i. e. of `critical` priority or not
+prioritized ones), notice that the logical "or" should be used for joining the
+same properties:
+
+    $ hg ilist -p priority=critical -p priority!=''
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/f09aeee4b1552679/new/1259361432.M651088P97096Q1.gto.home	Sat Jan 16 11:42:57 2010 -0800
@@ -0,0 +1,12 @@
+From: Alexander Solovyov <piranha@piranha.org.ua>
+Date: Sat, 28 Nov 2009 00:33:33
+State: new
+Subject: iadd should commit on finish
+Message-Id: <f09aeee4b1552679-0-artemis@gto.home>
+
+Actually there is two possibilities - one is to leave behavior as is and just
+add '--commit' option, and another is to commit after finishing and add
+'--no-commit' option.
+
+I think that second option is better as it's seems usual to commit immediately
+after issue change. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/fcdf8a97e633be4c/new/1259362084.M882641P97227Q1.gto.home	Sat Jan 16 11:42:57 2010 -0800
@@ -0,0 +1,8 @@
+From: Alexander Solovyov <piranha@piranha.org.ua>
+Date: Sat, 28 Nov 2009 00:46:52
+State: new
+Subject: issues are created in local date without timezone
+Message-Id: <fcdf8a97e633be4c-0-artemis@gto.home>
+
+Timezone is necessary to have issues syncronized in time between different time
+zones. ;-)
--- a/README	Wed Jan 13 09:52:28 2010 -0800
+++ b/README	Sat Jan 16 11:42:57 2010 -0800
@@ -134,6 +134,9 @@
         do not launch an editor to record a comment (useful if only changing
         properties)
 
+    `-m`, --message`
+        use ``text`` as an issue subject
+
 
 `ilist`
     List issues.
@@ -169,6 +172,9 @@
     `-x`, `--extract`
         extract attachments (given their numbers)
 
+    `--mutt`
+        use ``mutt`` to show issue
+
 
 Filters
 -------
--- a/artemis.py	Wed Jan 13 09:52:28 2010 -0800
+++ b/artemis.py	Sat Jan 16 11:42:57 2010 -0800
@@ -1,5 +1,5 @@
 # Author: Dmitriy Morozov <hg@foxcub.org>, 2007 -- 2009
-        
+
 """A very simple and lightweight issue tracker for Mercurial."""
 
 from mercurial import hg, util
@@ -66,7 +66,7 @@
                 property_match = property_match and (mbox[root][property] == value)
             else:
                 property_match = property_match and (property not in mbox[root])
-        
+
         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
         if match_date and not date_match(util.parsedate(mbox[root]['date'])[0]): continue
 
@@ -114,9 +114,17 @@
     # Get properties, and figure out if we need an explicit comment
     properties = _get_properties(opts['property'])
     no_comment = id and properties and opts['no_property_comment']
+    message = opts['message']
 
     # Create the text
-    if not no_comment:
+    if message:
+        if not id:
+            state_str = 'State: %s\n' % state['default']
+        else:
+            state_str = ''
+        issue = "From: %s\nDate: %s\nSubject: %s\n%s" % \
+                (user, util.datestr(format=date_format), message, state_str)
+    elif not no_comment:
         issue = ui.edit(default_issue_text, user)
 
         if issue.strip() == '':
@@ -127,8 +135,8 @@
             return
     else:
         # Write down a comment about updated properties
-        properties_subject = ', '.join(['%s=%s' % (property, value) for (property, value) in properties])            
-    
+        properties_subject = ', '.join(['%s=%s' % (property, value) for (property, value) in properties])
+
         issue =     "From: %s\nDate: %s\nSubject: changed properties (%s)\n" % \
                      (user, util.datestr(format = date_format), properties_subject)
 
@@ -187,17 +195,21 @@
 
     comment = int(comment)
     issue, id = _find_issue(ui, repo, id)
-    if not issue: return
+    if not issue:
+        return ui.warn('No such issue\n')
     
     issues_dir = ui.config('artemis', 'issues', default = default_issues_dir)
     _create_missing_dirs(os.path.join(repo.root, issues_dir), issue)
 
+    if opts.get('mutt'):
+        return util.system('mutt -R -f %s' % issue)
+
     mbox = mailbox.Maildir(issue, factory=mailbox.MaildirMessage)
 
     if opts['all']:
         ui.write('='*70 + '\n')
         i = 0
-        keys = _order_keys_date(mbox) 
+        keys = _order_keys_date(mbox)
         for k in keys:
             _write_message(ui, mbox[k], i, skip = opts['skip'])
             ui.write('-'*70 + '\n')
@@ -395,18 +407,21 @@
                   ('d', 'date', '', 'restrict to issues matching the date (e.g., -d ">12/28/2007)"'),
                   ('f', 'filter', '', 'restrict to pre-defined filter (in %s/%s*)' % (default_issues_dir, filter_prefix))],
                  _('hg ilist [OPTIONS]')),
-    'iadd':       (iadd, 
+    'iadd':       (iadd,
                  [('a', 'attach', [],
                    'attach file(s) (e.g., -a filename1 -a filename2)'),
                   ('p', 'property', [],
                    'update properties (e.g., -p state=fixed)'),
                   ('n', 'no-property-comment', None,
-                   'do not add a comment about changed properties')], 
+                   'do not add a comment about changed properties'),
+                  ('m', 'message', '',
+                   'use <text> as an issue subject')],
                  _('hg iadd [OPTIONS] [ID] [COMMENT]')),
     'ishow':      (ishow,
                  [('a', 'all', None, 'list all comments'),
                   ('s', 'skip', '>', 'skip lines starting with a substring'),
-                  ('x', 'extract', [], 'extract attachments (provide attachment number as argument)')],
+                  ('x', 'extract', [], 'extract attachments (provide attachment number as argument)'),
+                  ('', 'mutt', False, 'use mutt to show issue')],
                  _('hg ishow [OPTIONS] ID [COMMENT]')),
 }