artemis.py
changeset 54 bd974d9e58a2
parent 50 10fa939a4a3e
child 55 c379bed603c6
equal deleted inserted replaced
51:0c560be0cd5a 54:bd974d9e58a2
     1 # Author: Dmitriy Morozov <hg@foxcub.org>, 2007 -- 2009
     1 # Author: Dmitriy Morozov <hg@foxcub.org>, 2007 -- 2009
     2 
     2 
     3 """A very simple and lightweight issue tracker for Mercurial."""
     3 """A very simple and lightweight issue tracker for Mercurial."""
     4 
     4 
     5 from mercurial import hg, util
     5 from mercurial import hg, util, commands
     6 from mercurial.i18n import _
     6 from mercurial.i18n import _
     7 import os, time, random, mailbox, glob, socket, ConfigParser
     7 import os, time, random, mailbox, glob, socket, ConfigParser
     8 import mimetypes
     8 import mimetypes
     9 from email import encoders
     9 from email import encoders
    10 from email.generator import Generator
    10 from email.generator import Generator
   167     else:
   167     else:
   168         root = keys[0]
   168         root = keys[0]
   169         outer.add_header('Message-Id', "<%s-%s-artemis@%s>" % (issue_id, _random_id(), socket.gethostname()))
   169         outer.add_header('Message-Id', "<%s-%s-artemis@%s>" % (issue_id, _random_id(), socket.gethostname()))
   170         outer.add_header('References', mbox[(comment < len(mbox) and keys[comment]) or root]['Message-Id'])
   170         outer.add_header('References', mbox[(comment < len(mbox) and keys[comment]) or root]['Message-Id'])
   171         outer.add_header('In-Reply-To', mbox[(comment < len(mbox) and keys[comment]) or root]['Message-Id'])
   171         outer.add_header('In-Reply-To', mbox[(comment < len(mbox) and keys[comment]) or root]['Message-Id'])
   172     repo.add([issue_fn[(len(repo.root)+1):] + '/new/'  + mbox.add(outer)])   # +1 for the trailing /
   172     new_bug_path = issue_fn[(len(repo.root)+1):] + '/new/' + mbox.add(outer) # + 1 for the trailing /
       
   173     commands.add(ui, repo, new_bug_path)
   173 
   174 
   174     # Fix properties in the root message
   175     # Fix properties in the root message
   175     if properties:
   176     if properties:
   176         root = _find_root_key(mbox)
   177         root = _find_root_key(mbox)
   177         msg = mbox[root]
   178         msg = mbox[root]