Skip to content
Snippets Groups Projects
Commit 79604fc7 authored by Michael James Gratton's avatar Michael James Gratton Committed by Carlos Soriano
Browse files

Look for imported Yorba bugs and clean up the first comment if found.

When Yorba moved their application hosting over to GNOME's
infrastructure for Geary, Shotwell, and other projects, the bug
import from their bug tracker produced buzilla bugs containing the
complete bug history in comment 0.

This looks for such import bugs, cleans up the text a bit to to make
it somewhat more readable, and replaces `#1`, `#2`, etc in the text
with `Comment 1`, `Comment 2`, etc so early gitlab issues don't get
spammed with huge numbers of mentions.
parent 64fdae8c
No related branches found
No related tags found
No related merge requests found
......@@ -110,6 +110,27 @@ def processbug(bgo, target, user_cache, bzbug):
return '\n\n'.join(converted_paragraphs)
def is_yorba_import(comment):
body = comment['text']
is_yorba = (
'Original URL: http://redmine.yorba.org/issues/' in body and
'Searchable id: yorba-bug-' in body
)
if is_yorba:
body = re.sub(r'####\n\n#', '---\n\nComment ', body)
body = re.sub(
r'\n(Original [a-zA-Z ]+: [a-zA-Z0-9.:\/ ]+)', r'\n\1 ', body
)
body = re.sub(
r'\n(Searchable id: [a-zA-Z0-9-]+)', r'\n\1 ', body
)
body = re.sub(r'\n(related to [a-zA-Z]+ - )', r'\n * \1', body)
body = re.sub(r'\n(duplicated by [a-zA-Z]+ - )', r'\n * \1', body)
body = re.sub(r'\n(blocked by [a-zA-Z]+ - )', r'\n * \1', body)
comment['text'] = body
return is_yorba
def analyze_bugzilla_comment(comment, attachment_metadata):
body = comment['text']
......@@ -156,8 +177,9 @@ def processbug(bgo, target, user_cache, bzbug):
comments = bzbug.getcomments()
firstcomment = None if len(comments) < 1 else comments[0]
is_yorba = is_yorba_import(firstcomment)
desctext = None
if firstcomment['author'] == bzbug.creator:
if firstcomment['author'] == bzbug.creator or is_yorba:
desctext = firstcomment['text']
if 'attachment_id' in firstcomment:
desctext += '\n' + migrate_attachment(firstcomment,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment