Skip to content

Commit

Permalink
Check if 'original_head' variable is defined in clean_up at merge script
Browse files Browse the repository at this point in the history
  • Loading branch information
HyukjinKwon committed May 17, 2018
1 parent bfd75cd commit 772f069
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions dev/merge_spark_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ def continue_maybe(prompt):


def clean_up():
print("Restoring head pointer to %s" % original_head)
run_cmd("git checkout %s" % original_head)
if 'original_head' in globals():
print("Restoring head pointer to %s" % original_head)
run_cmd("git checkout %s" % original_head)

branches = run_cmd("git branch").replace(" ", "").split("\n")
branches = run_cmd("git branch").replace(" ", "").split("\n")

for branch in filter(lambda x: x.startswith(BRANCH_PREFIX), branches):
print("Deleting local branch %s" % branch)
run_cmd("git branch -D %s" % branch)
for branch in filter(lambda x: x.startswith(BRANCH_PREFIX), branches):
print("Deleting local branch %s" % branch)
run_cmd("git branch -D %s" % branch)


# merge the requested PR and return the merge hash
Expand Down

0 comments on commit 772f069

Please sign in to comment.