Skip to content

Add cherry_pick.py script for ORT release#27333

Open
tianleiwu wants to merge 3 commits intomainfrom
tlwu/20260212/cherry_pick_script
Open

Add cherry_pick.py script for ORT release#27333
tianleiwu wants to merge 3 commits intomainfrom
tlwu/20260212/cherry_pick_script

Conversation

@tianleiwu
Copy link
Contributor

@tianleiwu tianleiwu commented Feb 12, 2026

This PR introduces a new Python script, cherry_pick.py, to automate the cherry-picking process for release branches.

Features

  • Automated List Generation: Fetches merged PRs with a specific label (e.g., release:1.24.2) using the gh CLI.
  • Sorted Output: Sorts PRs by merge date to ensure chronological application.
  • Batch File Creation: Generates a .cmd file with git cherry-pick commands.
  • Markdown Notes: Generates a markdown file (cherry_pick_pr_description.md) suitable for the release PR description.
  • Dependency Checking: Checks for potential missing dependencies (conflicts) by verifying if files modified by the cherry-picked commits have prior modifications in the target branch that are not included in the cherry-pick list.
    • Warns about missing commits and lists affected files.

Usage

python cherry_pick.py --label "release:1.24.2" --output cherry_pick.cmd --branch "origin/rel-1.24.2"

Arguments

  • --label: Label to filter PRs (required).
  • --output: Output path for the batch file (required).
  • --repo: Target repository (default: microsoft/onnxruntime).
  • --branch: Target branch to compare against for dependency checks (default: HEAD).

Example Output

Fetching merged PRs with label 'release:1.24.2' from microsoft/onnxruntime...
Generated cherry_pick.cmd with 15 commits.
Generated cherry_pick_pr_description.md with 15 commits.

Checking for potential missing dependencies (conflicts)...
WARNING: In PR #27256 (5645b77...), file 'onnxruntime/core/platform/windows/telemetry.cc' was modified by commit 9486eedc4... (Record service in telemetry events (#27252)) which is not included in the cherry-pick list.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can commit the suggested changes from lintrunner.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new helper script under tools/python/ to streamline generating release-branch cherry-pick command batches and accompanying PR-description notes, using GitHub CLI metadata and optional git-history checks to flag potential missing related commits.

Changes:

  • Introduces tools/python/cherry_pick.py to query merged PRs by label via gh pr list, sort by merge time, and emit a .cmd file of git cherry-pick commands.
  • Generates cherry_pick_pr_description.md containing the set of PR numbers included in the cherry-pick batch.
  • Adds a “missing dependencies” heuristic that inspects git history for other commits touching the same files that aren’t in the cherry-pick set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant