Skip to content

Instantly share code, notes, and snippets.

@damirazo
Forked from movEAX/gist:7794950
Last active December 30, 2015 10:58
Show Gist options
  • Save damirazo/7819054 to your computer and use it in GitHub Desktop.
Save damirazo/7819054 to your computer and use it in GitHub Desktop.
# coding: utf-8
import re
from redmine import Redmine
def note_to_redmine(ui, repo, node, **kwargs):
redmine_url = ui.config('redmine', 'url')
note_format = ui.config('redmine', 'note')
api_key = ui.config('redmine', 'key')
commit_message = repo[node].description()
issues = re.findall(r'(?<=#)\d+', commit_message)
rm = Redmine(redmine_url, key=api_key)
note = note_format.format(rev=node)
for issue_num in issues:
issue = rm.issues[issue_num]
issue.save(note)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment