arthur-debert/google-code-issues-migrator — pull request #35 by davidsansome (2013-12-06 13:03:51+00:00)
Title: Don't try to add empty labels

When AllLabels is the empty string (as is the case in https://code.google.com/p/clementine-player/issues/detail?id=430) github rejects the empty label with this error:

Traceback (most recent call last):
File "migrateissues.py", line 396, in
process_gcode_issues(existing_issues)
File "migrateissues.py", line 293, in process_gcode_issues
github_issue = add_issue_to_github(issue)
File "migrateissues.py", line 101, in add_issue_to_github
github_labels = [github_label(label) for label in issue['labels']]
File "migrateissues.py", line 68, in github_label
return label_cache.setdefault(name, github_repo.create_label(name, color))
File "/usr/local/lib/python2.7/dist-packages/github/Repository.py", line 882, in create_label
input=post_parameters
File "/usr/local/lib/python2.7/dist-packages/github/Requester.py", line 168, in requestJsonAndCheck
return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
File "/usr/local/lib/python2.7/dist-packages/github/Requester.py", line 176, in __check
raise self.__createException(status, output)
github.GithubException.GithubException: 422 {u'documentation_url': u'http://developer.github.com/v3/issues/labels/#create-a-label', u'message': u'Validation Failed', u'errors': [{u'field': u'name', u'code': u'missing_field', u'resource': u'Label'}]}