Problem
A downstream carry commit tagged UPSTREAM: 123: can only reference a single upstream PR. When the same fix exists as separate PRs on different upstream branches (e.g., PR 123 on main and PR 456 on release-4.18), there is no way to express that the commit should be dropped if either PR is merged into the source branch.
This causes problems during branch transitions: when the downstream switches from syncing one upstream branch to another, carry commits referencing PRs from the old branch are silently carried even though the fix is present via a different PR.
Related: #90 (branch mismatch detection) surfaces this problem; the multi-PR syntax provides a resolution.
Proposed Solution
Extend the UPSTREAM tag format to accept two PR numbers separated by | (OR):
UPSTREAM: 123|456: Fix something
Semantics: Drop the commit if any of the listed PRs is merged into the source branch. Carry if none are merged.
Scope:
- OR operator only — no AND operator (no concrete use case identified)
- Two PR numbers maximum — sufficient for the branch transition scenario
When to use
Single PR — rebasebot is syncing the upstream branch where the fix landed. Use the PR number for that branch. This is the normal case.
Two PRs — the same fix exists as PRs on two upstream branches (e.g., main and a release branch), and the downstream may sync against either branch depending on timing. List both so the commit is dropped regardless of which branch is being synced.
Implementation
Extract tag parsing from _add_to_rebase into a _parse_commit_tag helper:
<drop> → ("drop", [])
<carry> → ("carry", [])
123 → ("pr", [123])
123|456 → ("pr", [123, 456])
Invalid tags (non-numeric parts, empty segments) raise an exception as today.
_add_to_rebase uses the parsed result: for "pr" kind, evaluate not any(_is_pr_merged(n, ...) for n in pr_numbers).
Problem
A downstream carry commit tagged
UPSTREAM: 123:can only reference a single upstream PR. When the same fix exists as separate PRs on different upstream branches (e.g., PR 123 onmainand PR 456 onrelease-4.18), there is no way to express that the commit should be dropped if either PR is merged into the source branch.This causes problems during branch transitions: when the downstream switches from syncing one upstream branch to another, carry commits referencing PRs from the old branch are silently carried even though the fix is present via a different PR.
Related: #90 (branch mismatch detection) surfaces this problem; the multi-PR syntax provides a resolution.
Proposed Solution
Extend the UPSTREAM tag format to accept two PR numbers separated by
|(OR):Semantics: Drop the commit if any of the listed PRs is merged into the source branch. Carry if none are merged.
Scope:
When to use
Single PR — rebasebot is syncing the upstream branch where the fix landed. Use the PR number for that branch. This is the normal case.
Two PRs — the same fix exists as PRs on two upstream branches (e.g.,
mainand a release branch), and the downstream may sync against either branch depending on timing. List both so the commit is dropped regardless of which branch is being synced.Implementation
Extract tag parsing from
_add_to_rebaseinto a_parse_commit_taghelper:<drop>→("drop", [])<carry>→("carry", [])123→("pr", [123])123|456→("pr", [123, 456])Invalid tags (non-numeric parts, empty segments) raise an exception as today.
_add_to_rebaseuses the parsed result: for"pr"kind, evaluatenot any(_is_pr_merged(n, ...) for n in pr_numbers).