Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
DL-29: The merge PR script should delete branches once the PR are merged
Browse files Browse the repository at this point in the history
Author: Sijie Guo <sijieg@twitter.com>

Reviewers: Franck Cuny <franck.cuny@gmail.com>

Closes #24 from sijie/sijie/fix_merge_script
  • Loading branch information
Sijie Guo committed Sep 13, 2016
1 parent a72d547 commit c22cad2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scripts/dev/dl-merge-pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit c22cad2

Please sign in to comment.