Skip to content

Tools: list and pick the upstream fixes this fork has not taken - #22

Merged
ayiskakov merged 2 commits into
mainfrom
feat/upstream-candidates
Sep 24, 2026
Merged

ayiskakov merged 2 commits into
mainfrom
feat/upstream-candidates

Conversation

@ayiskakov

Copy link
Copy Markdown
Owner

What

Tools/upstream-candidates.py lists the upstream commits this fork has not taken yet and says which of them apply, so upstream's fixes (the BLE stack above all) can be taken one at a time with git cherry-pick -x instead of by a wholesale merge, which stopped working once Android, Oura/Polar/Huami and WHOOP 4.0 were removed here (three days of upstream came to 84 conflicts, 72 in deleted files).

  • Hidden: commits that only touch code this fork removed; commits already taken (a -x trailer, or the same patch id); commits declined in Tools/upstream-skip.txt. --all lists them with the reason.
  • For the rest: a git merge-tree simulation against HEAD (no index or work-tree change), reported as clean, clean, N rm (also edits N files this fork removed) or N conflicts. A commit that only conflicts because it builds on an earlier candidate is re-simulated on top of it and marked ^ when it then applies.
  • --apply <sha>...: picks in upstream order with -x, drops the files this fork removed when those are the only conflicts, and stops before any commit that needs a hand resolution, leaving the tree clean. A file missing only because the upstream commit that adds it has not been taken is a conflict, never a drop.

Tools/upstream-skip.txt starts with today's review: six commits that do nothing for a 5.0/MG Apple build or that this fork has superseded, plus upstream's testing build numbers by subject.

Tools/upstream-candidates.py --fetch                 # what is new
Tools/upstream-candidates.py --area ble,protocol -v  # files, conflicts, what a ^ needs
Tools/upstream-candidates.py --apply <sha>...        # on a branch, not main

Verification

  • Tools/test_upstream_candidates.py: 40 tests against a throwaway repository shaped like this history (Android-only commits, both-platform fixes, clashes with the fork, chains, a file added by an earlier upstream commit, picked, same patch, declined). Isolated from the user's git config.
  • Mutation checks: reverting the directory rule, the pre-simulation stop in --apply, or the removed-versus-not-yet-added rule each fails its tests.
  • Real repo: all 16 commits hidden as removed-only were checked by hand (every path is in android/, Oura or the parity files); --apply of five real upstream commits on a throwaway worktree landed them in upstream order with -x trailers, no android/ resurrected, and an out-of-order follow-up applied once its predecessor was in.
  • Full core Tools suite locally: 106 tests; the 4 failures are in test_check_source_references (macOS /var vs /private/var temp paths), unrelated and unchanged by this PR.

…ick them with -x

This fork removed Android, the Oura/Polar/Huami peripherals and WHOOP 4.0, so merging
upstream/main wholesale no longer works: three days of it (56 commits) came to 84
conflicts, 72 of them in deleted files. The fixes worth having, the BLE stack above all,
are taken one at a time instead, and Tools/upstream-candidates.py finds them.

It hides upstream commits that only touch code this fork removed, ones already taken (a
`cherry-pick -x` trailer, or the same patch id), and ones declined in
Tools/upstream-skip.txt. It simulates each of the rest against HEAD with
`git merge-tree` and reports clean, clean once the files this fork removed are dropped,
or N conflicts. A commit that only conflicts because it builds on an earlier candidate
is re-simulated on top of it through throwaway commits, and marked `^` when it then
applies.

`--apply <sha>...` picks in upstream order with -x, `git rm`s the files this fork
removed when those are the only conflicts, and stops before a commit that would need a
hand resolution, leaving the tree clean. A file that is missing only because the
upstream commit that adds it has not been taken is a conflict, never a drop: dropping it
would cut part of the fix out of the pick without a word.

Tools/test_upstream_candidates.py pins each rule against a throwaway repository shaped
like this history (40 tests, standard unittest, run by tools-python.yml).
…dger

Six upstream commits from a56840b..141cbd9 that do nothing for a WHOOP 5.0/MG Apple
build (WHOOP 4.0, the Oura hypnogram heal, chest-strap and gym-machine reconnects, an
Android test pin, a refactor-only Apple half) or that this fork has superseded (the REM
funnel line), plus upstream's testing build numbers by subject.
@ayiskakov
ayiskakov merged commit 01baf82 into main Sep 24, 2026
4 checks passed
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