| 527 | |
| 528 | |
| 529 | def get_primary_author(cmd, distinct_authors): |
| 530 | author_pat = re.compile(r'(.*) <(.*)>') |
| 531 | |
| 532 | while True: |
| 533 | primary_author = cmd.prompt( |
| 534 | "Enter primary author in the format of " |
| 535 | "\"name <email>\" [%s]: " % distinct_authors[0]) |
| 536 | |
| 537 | if primary_author == "": |
| 538 | return distinct_authors[0], distinct_authors[1:] |
| 539 | |
| 540 | if author_pat.match(primary_author): |
| 541 | break |
| 542 | print(f'Bad author "{primary_author}", please try again') |
| 543 | |
| 544 | # When primary author is specified manually, de-dup it from |
| 545 | # author list and put it at the head of author list. |
| 546 | distinct_other_authors = [x for x in distinct_authors |
| 547 | if x != primary_author] |
| 548 | return primary_author, distinct_other_authors |
| 549 | |
| 550 | |
| 551 | def prompt_for_fix_version(cmd, issue, maintenance_branches=()): |