This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new b5f76b130194 [SPARK-48723][INFRA] Run `git cherry-pick --abort` if
backporting is denied by committer
b5f76b130194 is described below
commit b5f76b1301947bdec4819318557b38134f61b69c
Author: Kent Yao <[email protected]>
AuthorDate: Thu Jun 27 10:57:06 2024 +0900
[SPARK-48723][INFRA] Run `git cherry-pick --abort` if backporting is denied
by committer
### What changes were proposed in this pull request?
This pull request includes the addition of `git cherry-pick --abort` to run
if backporting is denied by committers.
Otherwise, the unresolved cherry-pick context will block following command
to be run properly
```python
Error cherry-picking: Command '['git', 'cherry-pick', '-sx', 'e23d69b0']'
returned non-zero exit status 1.
y fix-up this merge? (y/N): n
Okay, exiting
Restoring head pointer to master
git checkout master
error: you need to resolve your current index first
Restoring head pointer to master
git checkout master
error: you need to resolve your current index first
Traceback (most recent call last):
File "/Users/hzyaoqin/spark/./dev/merge_spark_pr.py", line 234, in
cherry_pick
File "/Users/hzyaoqin/spark/./dev/merge_spark_pr.py", line 118, in run_cmd
File
"/opt/homebrew/Cellar/python3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py",
line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
### Why are the changes needed?
improve merge PR progress
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
Locally with python interpreter:
```python
>>> cherry_pick(47082, "e23d69b", "branch-3.5")
Enter a branch name [branch-3.5]:
git fetch apache branch-3.5:PR_TOOL_PICK_PR_47082_BRANCH-3.5
From github.com:apache/spark
* [new branch] branch-3.5 -> PR_TOOL_PICK_PR_47082_BRANCH-3.5
git checkout PR_TOOL_PICK_PR_47082_BRANCH-3.5
Updating files: 100% (6027/6027), done.
Switched to branch 'PR_TOOL_PICK_PR_47082_BRANCH-3.5'
git cherry-pick -sx e23d69b
error: could not apply e23d69b0f1d... [SPARK-48709][SQL] Fix varchar type
resolution mismatch for DataSourceV2 CTAS
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
Error cherry-picking: Command '['git', 'cherry-pick', '-sx', 'e23d69b']'
returned non-zero exit status 1.
fix-up this merge? (y/N): n
git cherry-pick --abort
Okay, exiting
```
### Was this patch authored or co-authored using generative AI tooling?
no
Closes #47101 from yaooqinn/SPARK-48723.
Authored-by: Kent Yao <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
dev/merge_spark_pr.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py
index fff6df62701d..4ebd3e4b951f 100755
--- a/dev/merge_spark_pr.py
+++ b/dev/merge_spark_pr.py
@@ -118,9 +118,14 @@ def run_cmd(cmd):
return subprocess.check_output(cmd.split(" ")).decode("utf-8")
-def continue_maybe(prompt):
+def continue_maybe(prompt, cherry=False):
result = bold_input("%s (y/N): " % prompt)
if result.lower() != "y":
+ if cherry:
+ try:
+ run_cmd("git cherry-pick --abort")
+ except Exception:
+ print_error("Unable to abort and get back to the state before
cherry-pick")
fail("Okay, exiting")
@@ -234,9 +239,9 @@ def cherry_pick(pr_num, merge_hash, default_branch):
run_cmd("git cherry-pick -sx %s" % merge_hash)
except Exception as e:
msg = "Error cherry-picking: %s\nWould you like to manually fix-up
this merge?" % e
- continue_maybe(msg)
+ continue_maybe(msg, True)
msg = "Okay, please fix any conflicts and finish the cherry-pick.
Finished?"
- continue_maybe(msg)
+ continue_maybe(msg, True)
continue_maybe(
"Pick complete (local ref %s). Push to %s?" % (pick_branch_name,
PUSH_REMOTE_NAME)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]