GitHub user HyukjinKwon opened a pull request:
https://github.com/apache/spark/pull/21349
[MINOR][PROJECT-INFRA] Check if 'original_head' variable is defined in
clean_up at merge script
## What changes were proposed in this pull request?
This PR proposes to check if global variable exists or not in clean_up.
This can happen when it fails at:
https://github.com/apache/spark/blob/7013eea11cb32b1e0038dc751c485da5c94a484b/dev/merge_spark_pr.py#L423
## How was this patch tested?
Manually tested:
**Before**
```
git rev-parse --abbrev-ref HEAD
fatal: Not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File "./dev/merge_spark_pr_jira.py", line 517, in <module>
clean_up()
File "./dev/merge_spark_pr_jira.py", line 104, in clean_up
print("Restoring head pointer to %s" % original_head)
NameError: global name 'original_head' is not defined
```
**After**
```
git rev-parse --abbrev-ref HEAD
fatal: Not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File "./dev/merge_spark_pr.py", line 516, in <module>
main()
File "./dev/merge_spark_pr.py", line 424, in main
original_head = get_current_ref()
File "./dev/merge_spark_pr.py", line 412, in get_current_ref
ref = run_cmd("git rev-parse --abbrev-ref HEAD").strip()
File "./dev/merge_spark_pr.py", line 94, in run_cmd
return subprocess.check_output(cmd.split(" "))
File
"/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['git', 'rev-parse',
'--abbrev-ref', 'HEAD']' returned non-zero exit status 128
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/HyukjinKwon/spark minor-merge-script
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/21349.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #21349
----
commit 72a4505cee6590ca98931fb5533df6acbd5868b6
Author: hyukjinkwon <gurwls223@...>
Date: 2018-05-17T04:03:57Z
Check if 'original_head' variable is defined in clean_up at merge script
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]