szehon-ho opened a new pull request, #56261:
URL: https://github.com/apache/spark/pull/56261

   ### What changes were proposed in this pull request?
   
   This PR makes the cherry-pick branch prompt in `dev/merge_spark_pr.py` 
re-prompt on a typo instead of crashing.
   
   Previously, `cherry_pick` read a branch name and passed it straight to 
`_do_cherry_pick`, whose first action is `git fetch <PUSH_REMOTE> 
<pick_ref>:<temp>`. `run_cmd` uses `subprocess.check_output`, which raises 
`CalledProcessError` on a non-zero exit. The `try/except` in `_do_cherry_pick` 
only wraps the later `git cherry-pick` call, not this fetch, so a mistyped 
branch name made the fetch fail and the exception propagated to the top-level 
handler in `main`, which cleaned up the temp branches and re-raised, aborting 
the entire merge session with a traceback.
   
   The branch prompt now validates the entered name against `branch_names` (the 
list of `branch-*` release branches already fetched from the GitHub API) in a 
loop. On an unrecognized name it prints the list of valid branches and 
re-prompts; an empty input still accepts the default branch (which is always 
valid).
   
   ### Why are the changes needed?
   
   Mistyping a branch name at the cherry-pick prompt is an easy mistake for a 
committer to make, and it previously crashed the whole merge tool, forcing the 
committer to restart the merge/backport flow. Re-prompting lets them simply 
correct the typo and continue.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This only affects the committer-facing behavior of the merge tool: the 
cherry-pick branch prompt now re-prompts on an invalid branch name instead of 
aborting.
   
   ### How was this patch tested?
   
   Ran the module's doctests (`python3 -m doctest dev/merge_spark_pr.py`); all 
57 tests pass. Manually verified the validation loop re-prompts on an unknown 
branch and accepts both a valid branch and the default (empty input).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Cursor (Claude Opus 4.8)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to