Repository: incubator-distributedlog Updated Branches: refs/heads/master a72d5477e -> c22cad200
DL-29: The merge PR script should delete branches once the PR are merged Author: Sijie Guo <[email protected]> Reviewers: Franck Cuny <[email protected]> Closes #24 from sijie/sijie/fix_merge_script Project: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/commit/c22cad20 Tree: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/tree/c22cad20 Diff: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/diff/c22cad20 Branch: refs/heads/master Commit: c22cad200533a88d581d3c6c6177f4af0bd82d5b Parents: a72d547 Author: Sijie Guo <[email protected]> Authored: Mon Sep 12 18:42:17 2016 -0700 Committer: Sijie Guo <[email protected]> Committed: Mon Sep 12 18:42:17 2016 -0700 ---------------------------------------------------------------------- scripts/dev/dl-merge-pr.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/c22cad20/scripts/dev/dl-merge-pr.py ---------------------------------------------------------------------- diff --git a/scripts/dev/dl-merge-pr.py b/scripts/dev/dl-merge-pr.py index 14e4833..81a3cf1 100755 --- a/scripts/dev/dl-merge-pr.py +++ b/scripts/dev/dl-merge-pr.py @@ -139,7 +139,7 @@ def clean_up(): print('Restoring head pointer to {0}'.format(original_head)) run_cmd(['git', 'checkout', original_head]) - branches = run_cmd(['git', 'branch']).rstrip().split('\n') + branches = run_cmd(['git', 'branch']).strip().split('\n') for branch in filter(lambda x: x.startswith(TEMP_BRANCH_PREFIX), branches): print('Deleting local branch {0}'.format(branch)) @@ -431,7 +431,19 @@ def get_reviewers(pr_num): reviewers_emails = [] for reviewer_id in reviewers_ids: user = get_json('{0}/users/{1}'.format(GITHUB_API_URL, reviewer_id)) - reviewers_emails += ['{0} <{1}>'.format(user['name'].strip(), user['email'].strip())] + username = None + useremail = None + if user['email'] is not None: + useremail = user['email'].strip() + else: + useremail = None + if user['name'] is not None: + username = user['name'].strip() + else: + username = useremail + if username is None: + continue + reviewers_emails += ['{0} <{1}>'.format(username, useremail)] return ', '.join(reviewers_emails)
