artemis.py
changeset 15 e5b03298394e
parent 13 e155f2129514
child 16 49645303d045
equal deleted inserted replaced
14:e78a97664dba 15:e5b03298394e
     9 
     9 
    10 state = {'new': 'new', 'fixed': 'fixed'}
    10 state = {'new': 'new', 'fixed': 'fixed'}
    11 state['default'] = state['new']
    11 state['default'] = state['new']
    12 issues_dir = ".issues"
    12 issues_dir = ".issues"
    13 filter_prefix = ".filter"
    13 filter_prefix = ".filter"
    14 date_format = '%a, %d %b %Y %H:%M:%S %Z'
    14 date_format = '%a, %d %b %Y %H:%M:%S'
    15 
    15 
    16 
    16 
    17 def ilist(ui, repo, **opts):
    17 def ilist(ui, repo, **opts):
    18 	"""List issues associated with the project"""
    18 	"""List issues associated with the project"""
    19 
    19 
    48 		for property,value in properties: 
    48 		for property,value in properties: 
    49 			property_match = property_match and (mbox[0][property] == value)
    49 			property_match = property_match and (mbox[0][property] == value)
    50 		if not show_all and (not properties or not property_match) and (properties or mbox[0]['State'].upper() == state['fixed'].upper()): continue 
    50 		if not show_all and (not properties or not property_match) and (properties or mbox[0]['State'].upper() == state['fixed'].upper()): continue 
    51 
    51 
    52 
    52 
    53 		if match_date and not date_match(util.parsedate(mbox[0]['date'], [date_format])[0]): continue
    53 		if match_date and not date_match(util.parsedate(mbox[0]['date'])[0]): continue
    54 		ui.write("%s (%d) [%s]: %s\n" % (issue[len(issues_path)+1:], # +1 for trailing /
    54 		ui.write("%s (%d) [%s]: %s\n" % (issue[len(issues_path)+1:], # +1 for trailing /
    55 										 len(mbox)-1,				 # number of replies (-1 for self)
    55 										 len(mbox)-1,				 # number of replies (-1 for self)
    56 										 mbox[0]['State'],
    56 										 mbox[0]['State'],
    57 										 mbox[0]['Subject']))
    57 										 mbox[0]['Subject']))
    58 	
    58 	
    72 			ui.warn('No such issue\n')
    72 			ui.warn('No such issue\n')
    73 			return
    73 			return
    74 	
    74 	
    75 	user = ui.username()
    75 	user = ui.username()
    76 
    76 
    77 	default_issue_text  = 		"From: %s\nDate: %s\n" % (user, time.strftime(date_format))
    77 	default_issue_text  = 		"From: %s\nDate: %s\n" % (user, util.datestr(format = date_format))
    78 	if not id: 
    78 	if not id: 
    79 		default_issue_text += 	"State: %s\n" % state['default']
    79 		default_issue_text += 	"State: %s\n" % state['default']
    80 	default_issue_text +=		"Subject: brief description\n\n"
    80 	default_issue_text +=		"Subject: brief description\n\n"
    81 	default_issue_text += 		"Detailed description."
    81 	default_issue_text += 		"Detailed description."
    82 
    82 
   158 
   158 
   159 	# Write down a comment about updated properties
   159 	# Write down a comment about updated properties
   160 	if properties and not opts['no_property_comment']:
   160 	if properties and not opts['no_property_comment']:
   161 		user = ui.username()
   161 		user = ui.username()
   162 		properties_text  = 	"From: %s\nDate: %s\nSubject: properties changes (%s)\n\n%s" % \
   162 		properties_text  = 	"From: %s\nDate: %s\nSubject: properties changes (%s)\n\n%s" % \
   163 							(user, time.strftime(date_format),
   163 							(user, util.datestr(format = date_format),
   164 							 _pretty_list(list(set([property for property, value in properties]))), 
   164 							 _pretty_list(list(set([property for property, value in properties]))), 
   165 							 properties_text)
   165 							 properties_text)
   166 		msg = mailbox.mboxMessage(properties_text)
   166 		msg = mailbox.mboxMessage(properties_text)
   167 		msg.add_header('Message-Id', "<%s-%s-artemis@%s>" % (id, _random_id(), socket.gethostname()))
   167 		msg.add_header('Message-Id', "<%s-%s-artemis@%s>" % (id, _random_id(), socket.gethostname()))
   168 		msg.add_header('References', mbox[0]['Message-Id'])
   168 		msg.add_header('References', mbox[0]['Message-Id'])