Skip to content

Commit

Permalink
add fallback way for annotation on gerrit service
Browse files Browse the repository at this point in the history
The account information [1][2] on gerrit has changed over time. The
change add a fallback way when all optional fields are not set to use
the non-optional fields `_account_id`.

[1]: https://gerrit-documentation.storage.googleapis.com/Documentation/2.9/rest-api-accounts.html#account-info
[2]: https://gerrit-documentation.storage.googleapis.com/Documentation/2.14/rest-api-accounts.html#account-info

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
  • Loading branch information
silvio authored and ryneeverett committed Jul 29, 2017
1 parent 992d358 commit c1f7fc5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bugwarrior/services/gerrit.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ def build_url(self, change):
def annotations(self, change):
entries = []
for item in change['messages']:
username = item['author']['username']
for key in ['name', 'username', 'email']:
if key in item['author']:
username = item['author'][key]
break
else:
username = item['author']['_account_id']
# Gerrit messages are really messy
message = item['message']\
.lstrip('Patch Set ')\
Expand Down

0 comments on commit c1f7fc5

Please sign in to comment.