def make_commit_message(record): s = record['message'] module = record['module'] s = utils.format_text(s) # insert links s = re.sub(re.compile('(blueprint\s+)([\w-]+)', flags=re.IGNORECASE), r'\1<a href="https://blueprints.launchpad.net/' + module + r'/+spec/\2" class="ext_link">\2</a>', s) s = re.sub(re.compile('(bug[\s#:]*)([\d]{5,7})', flags=re.IGNORECASE), r'\1<a href="https://bugs.launchpad.net/bugs/\2" ' r'class="ext_link">\2</a>', s) s = re.sub(r'\s+(I[0-9a-f]{40})', r' <a href="https://git.opendaylight.org/gerrit/#q,\1,n,z" ' r'class="ext_link">\1</a>', s) s = utils.unwrap_text(s) return s
def make_commit_message(record): s = record['message'] module = record['module'] s = utils.format_text(s) # insert links s = re.sub( re.compile('(blueprint\s+)([\w-]+)', flags=re.IGNORECASE), r'\1<a href="https://blueprints.launchpad.net/' + module + r'/+spec/\2" class="ext_link">\2</a>', s) s = re.sub( re.compile('(bug[\s#:]*)([\d]{5,7})', flags=re.IGNORECASE), r'\1<a href="https://bugs.launchpad.net/bugs/\2" ' r'class="ext_link">\2</a>', s) s = re.sub( r'\s+(I[0-9a-f]{40})', r' <a href="https://git.opendaylight.org/gerrit/#q,\1,n,z" ' r'class="ext_link">\1</a>', s) s = utils.unwrap_text(s) return s
def test_unwrap(self): original = 'Lorem ipsum. Dolor\nsit amet.\n Lorem\n ipsum.\ndolor!\n' expected = 'Lorem ipsum. Dolor sit amet.\n Lorem\n ipsum.\ndolor!' self.assertEqual(expected, utils.unwrap_text(original))