Fix update_bug.py to match uploader format

Makes update_bug.py parse Gerrit uploader format correctly so
that assignee is set correctly on patchset-created. Use email
as search key if provided, otherwise use full name.
Fixes bug 907811.

Change-Id: I6d64b47504e3970683e071d4f0ba0ece023942cf
This commit is contained in:
Thierry Carrez
2011-12-22 16:44:50 +01:00
parent 39c12aaa09
commit 316e24fdcf

View File

@@ -53,9 +53,13 @@ Branch: %s\n''' % (change_url, git_url, submitter, branch)
def set_in_progress(bugtask, launchpad, uploader, change_url):
"""Set bug In progress with assignee being the uploader"""
# Retrieve uploader from Launchpad, if possible
email = uploader[uploader.rfind("<") + 1:-1]
persons = launchpad.people.findPerson(text=email)
# Retrieve uploader from Launchpad. Use email as search key if
# provided, and only set if there is a clear match.
try:
searchkey = uploader[uploader.rindex("(") + 1:-1]
except ValueError:
searchkey = uploader
persons = launchpad.people.findPerson(text=searchkey)
if len(persons) == 1:
bugtask.assignee = persons[0]