Index: sitescripts/hg/bin/update_issues.py |
=================================================================== |
--- a/sitescripts/hg/bin/update_issues.py |
+++ b/sitescripts/hg/bin/update_issues.py |
@@ -63,23 +63,36 @@ |
if not updates: |
return |
with _trac_proxy(ui, config, 'updating issue {}'.format(issue_id)) as tp: |
tp.ticket.update(issue_id, comment, changes, True) |
ui.status('updated {}:\n{}\n'.format(issue_url, '\n'.join(updates))) |
+def _format_description(change): |
+ lines = change.description().splitlines() |
+ message = lines[0].rstrip() |
+ if len(lines) == 1 or lines[1].strip() == '': |
+ return message |
+ if message.endswith('.'): |
Sebastian Noack
2016/05/26 10:44:07
This check seems redundant.
Vasily Kuznetsov
2016/05/26 19:34:00
Indeed. Done.
|
+ message = message.rstrip('.') |
+ return message + '...' |
+ |
+ |
def _post_comments(ui, repo, config, refs): |
repo_name = posixpath.split(repo.url())[1] |
template = get_template('hg/template/issue_commit_comment.tmpl', |
autoescape=False) |
for ref in refs: |
- comment_text = template.render({'repository_name': repo_name, |
- 'changes': ref.commits}) |
+ comment_text = template.render({ |
+ 'repository_name': repo_name, |
+ 'changes': ref.commits, |
+ 'format_description': _format_description |
+ }) |
with _trac_proxy(ui, config, 'getting issue {}'.format(ref.id)) as tp: |
attrs = tp.ticket.get(ref.id)[3] |
changes = {'_ts': attrs['_ts'], 'action': 'leave'} |
_update_issue(ui, config, ref.id, changes, comment_text) |
def _compile_module_regexps(ui, config, modules): |
for module, regexp in config.items('hg_module_milestones'): |