Added configuration option to provide an alternative path for the issues directory
authorDmitriy Morozov <dmitriy@mrzv.org>
Wed, 13 Jan 2010 09:52:28 -0800
changeset 35 2e7575352ef3
parent 34 714f9414b009
child 49 248ec36cef5f
Added configuration option to provide an alternative path for the issues directory
.issues/d9133b0e69e403c0/new/1239134046.M751897P28808Q1.cole
.issues/d9133b0e69e403c0/new/1242855469.M834125P3274Q1.cole
README
artemis.py
--- a/.issues/d9133b0e69e403c0/new/1239134046.M751897P28808Q1.cole	Sat Apr 11 15:44:02 2009 -0700
+++ b/.issues/d9133b0e69e403c0/new/1239134046.M751897P28808Q1.cole	Wed Jan 13 09:52:28 2010 -0800
@@ -1,7 +1,8 @@
 From: Dmitriy Morozov <dmitriy@mrzv.org>
 Date: Tue, 07 Apr 2009 12:53:56
-State: new
+State: resolved
 Subject: Documentation
 Message-Id: <d9133b0e69e403c0-0-artemis@cole>
+resolution: fixed
 
 Write documentation.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/d9133b0e69e403c0/new/1242855469.M834125P3274Q1.cole	Wed Jan 13 09:52:28 2010 -0800
@@ -0,0 +1,7 @@
+From: Dmitriy Morozov <dmitriy@mrzv.org>
+Date: Wed, 20 May 2009 14:37:49
+Subject: changed properties (state=resolved, resolution=fixed)
+Message-Id: <d9133b0e69e403c0-dcab00a2ae466066-artemis@cole>
+References: <d9133b0e69e403c0-0-artemis@cole>
+In-Reply-To: <d9133b0e69e403c0-0-artemis@cole>
+
--- a/README	Sat Apr 11 15:44:02 2009 -0700
+++ b/README	Wed Jan 13 09:52:28 2010 -0800
@@ -3,9 +3,10 @@
 
 Artemis is a lightweight distributed issue tracking extension for Mercurial_.
 
-Individual issues are stored in directories in an ``.issues`` subdirectory. Each
-one is a Maildir_ and each one is assumed to have a single root message.
-Various properties of an issue are stored in the headers of that message.
+Individual issues are stored in directories in an ``.issues`` subdirectory
+(overridable in a config file).  Each one is a Maildir_ and each one is assumed
+to have a single root message.  Various properties of an issue are stored in the
+headers of that message.
 
 .. _Mercurial:      http://www.selenic.com/mercurial/
 .. _Maildir:        http://en.wikipedia.org/wiki/Maildir
@@ -28,6 +29,12 @@
     
     artemis = /path/to/artemis.py
 
+Optionally, provide a section ``[artemis]``, and specify an alternative path for
+the issues subdirectory (instead of the default ``.issues``)::
+
+    [artemis]
+    issues = _issues
+
 
 Example
 -------
--- a/artemis.py	Sat Apr 11 15:44:02 2009 -0700
+++ b/artemis.py	Wed Jan 13 09:52:28 2010 -0800
@@ -17,7 +17,7 @@
 
 state = {'new': 'new', 'fixed': ['fixed', 'resolved']}
 state['default'] = state['new']
-issues_dir = ".issues"
+default_issues_dir = ".issues"
 filter_prefix = ".filter"
 date_format = '%a, %d %b %Y %H:%M:%S'
 maildir_dirs = ['new','cur','tmp']
@@ -34,6 +34,7 @@
         match_date, date_match = True, util.matchdate(opts['date'])
 
     # Find issues
+    issues_dir = ui.config('artemis', 'issues', default = default_issues_dir)
     issues_path = os.path.join(repo.root, issues_dir)
     if not os.path.exists(issues_path): return
 
@@ -91,6 +92,7 @@
     comment = int(comment)
 
     # First, make sure issues have a directory
+    issues_dir = ui.config('artemis', 'issues', default = default_issues_dir)
     issues_path = os.path.join(repo.root, issues_dir)
     if not os.path.exists(issues_path): os.mkdir(issues_path)
 
@@ -187,6 +189,7 @@
     issue, id = _find_issue(ui, repo, id)
     if not issue: return
     
+    issues_dir = ui.config('artemis', 'issues', default = default_issues_dir)
     _create_missing_dirs(os.path.join(repo.root, issues_dir), issue)
 
     mbox = mailbox.Maildir(issue, factory=mailbox.MaildirMessage)
@@ -224,6 +227,7 @@
 
 
 def _find_issue(ui, repo, id):
+    issues_dir = ui.config('artemis', 'issues', default = default_issues_dir)
     issues_path = os.path.join(repo.root, issues_dir)
     if not os.path.exists(issues_path): return False
 
@@ -389,7 +393,7 @@
                   ('p', 'property', [],
                    'list issues with specific field values (e.g., -p state=fixed); lists all possible values of a property if no = sign'),
                   ('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_prefix))],
+                  ('f', 'filter', '', 'restrict to pre-defined filter (in %s/%s*)' % (default_issues_dir, filter_prefix))],
                  _('hg ilist [OPTIONS]')),
     'iadd':       (iadd, 
                  [('a', 'attach', [],