Skip to content

Support multiple PR numbers in UPSTREAM tag with OR semantics #91

Description

@RadekManak

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions