Skip to content

[webkitscmpy] Separate cache by remote - #77838

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
JonWBedard:eng/webkitscmpy-cache-canonical-branches
Nov 6, 2026
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
JonWBedard:eng/webkitscmpy-cache-canonical-branches

Conversation

@JonWBedard

@JonWBedard JonWBedard commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

064aa09

[webkitscmpy] Separate cache by remote
https://bugs.webkit.org/show_bug.cgi?id=326753
rdar://189460513

Reviewed by Sam Sneddon.

Only cache commits from production branches on canonical remotes, since those branches never move
backwards, tracking each remote's copy of a branch separately and computing identifiers on demand.

* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
(Git.Cache): Cache keys are full remote refs.
(Git.Cache.load): Only read cached lists, discarding branches which aren't from canonical remotes.
(Git.Cache.is_cacheable): Only the default branch and production branches are cached.
(Git.Cache._remotes_for): The default branch is only tracked on the default remote.
(Git.Cache._key): Construct a cache key from a remote and branch.
(Git.Cache._parse_key): Extract the remote and branch from a cache key.
(Git.Cache._keys_for): Cache keys for a branch, ordered by remote security level.
(Git.Cache._save): Shared logic for atomically writing the cache to disk.
(Git.Cache._reset): Discard computed identifiers.
(Git.Cache._fill_branch): Compute identifiers for each copy of a branch.
(Git.Cache._branch_point): Determine a branch point from its position on the default branch, only identifiers on the default branch are branch points.
(Git.Cache._identifier_for):
(Git.Cache._search): Compute identifiers one branch at a time until a commit is found.
(Git.Cache._fill): Compute identifiers for a single remote's copy of a branch.
(Git.Cache.populate): Update every canonical copy of a branch, populating the default branch for branches we don't cache.
(Git.Cache._history_through): Find history shared with another copy of a branch.
(Git.Cache._populate): Walk a remote branch, skipping the walk if another copy already contains the tip. Fail if a branch intersects with itself without shared history. Never abbreviate commit hashes.
(Git.Cache._populate._append): Match branch names exactly.
(Git.Cache._lookup): Find an identifier on any copy of a branch.
(Git.Cache.to_hash): Use _lookup.
(Git.Cache.to_revision): Ditto.
(Git.Cache.to_identifier): Use _search.
(Git): Define the default remote before constructing the cache.
(Git.default_branch): Fall back to 'main' instead of None.
(Git.commit): Never abbreviate commit hashes.
(Git.commits): Ditto.
(Git.find): The default branch can no longer be None.
(Git.rebase): Local branches are no longer cached.
(Git.pull): Ditto.
(Git.remote_for):
(Git.Cache.populate._append): Deleted.
(Git.Cache.clear): Deleted.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
(resolve_all_commits): Handle remote refs moved by update-ref.
(rev_list.resolve): Resolve remote refs by the branch they name.
(rev_list): Use resolve.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/scm_base.py:
(ScmBase.default_branch): The default branch can no longer be None.
(ScmBase.branch_priority): Sort key used to canonicalize commits.
(ScmBase.prioritize_branches): Use branch_priority.
(ScmBase.find): The default branch can no longer be None.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
(TestGit.test_log):
(test_remote_for_default_branch):
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/scm_unittest.py:
(TestScm.test_prod_branches):
(TestScm):
(TestScm._Repository):
(TestScm.test_branch_priority):
(TestScm.test_branch_priority_sorted):
(TestScm.test_prioritize_branches):
(TestScm.test_prioritize_branches_preferred):

Canonical link: https://commits.webkit.org/325941@main

1d38c4d

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-cmake-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 webkitpy ✅ 🧪 ios-wk2-wpt ❌ 🧪 api-mac-cmake-debug
  🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🧪 mac-cmake-debug-wk2 ✅ 🛠 gtk
✅ 🧪 services ✅ 🛠 vision ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim   🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 unsafe-merge ✅ 🧪 vision-wk2 ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
  🛠 watch
✅ 🛠 watch-sim

@JonWBedard JonWBedard self-assigned this Oct 21, 2026
@JonWBedard JonWBedard added the Tools / Tests Tools in the Tools directory, build issues, test infrastructure, and bugs in test cases label Oct 21, 2026
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 22, 2026
@JonWBedard JonWBedard removed the merging-blocked Applied to prevent a change from being merged label Oct 22, 2026
@JonWBedard
JonWBedard force-pushed the eng/webkitscmpy-cache-canonical-branches branch from 29cf317 to 949201a Compare October 28, 2026 23:36

@gsnedders gsnedders left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the delay here; there's not a huge amount of non-nit comments here.

@JonWBedard
JonWBedard force-pushed the eng/webkitscmpy-cache-canonical-branches branch from 949201a to a34a64f Compare November 3, 2026 22:44
@JonWBedard
JonWBedard requested a review from gsnedders November 4, 2026 05:27

@gsnedders gsnedders left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We do seem to break older versions of git-webkit, which seems problematic.

@JonWBedard
JonWBedard force-pushed the eng/webkitscmpy-cache-canonical-branches branch from a34a64f to 1d38c4d Compare November 5, 2026 19:47
@JonWBedard

Copy link
Copy Markdown
Member Author

We do seem to break older versions of git-webkit, which seems problematic.

Good call. Did this in a bit of a different way (making the "remote" vs "local" explicit instead of a version), but it achieves the same effect.

@JonWBedard
JonWBedard requested a review from gsnedders November 5, 2026 19:48
@webkit-early-warning-system

Copy link
Copy Markdown
Collaborator

Starting EWS tests for 1d38c4d. Live statuses available at the PR page, #77838

@gsnedders gsnedders left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I still think an explicit version would be a good idea, but we can always do that as a follow-up I think.

@JonWBedard JonWBedard added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 6, 2026
https://bugs.webkit.org/show_bug.cgi?id=326753
rdar://189460513

Reviewed by Sam Sneddon.

Only cache commits from production branches on canonical remotes, since those branches never move
backwards, tracking each remote's copy of a branch separately and computing identifiers on demand.

* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
(Git.Cache): Cache keys are full remote refs.
(Git.Cache.load): Only read cached lists, discarding branches which aren't from canonical remotes.
(Git.Cache.is_cacheable): Only the default branch and production branches are cached.
(Git.Cache._remotes_for): The default branch is only tracked on the default remote.
(Git.Cache._key): Construct a cache key from a remote and branch.
(Git.Cache._parse_key): Extract the remote and branch from a cache key.
(Git.Cache._keys_for): Cache keys for a branch, ordered by remote security level.
(Git.Cache._save): Shared logic for atomically writing the cache to disk.
(Git.Cache._reset): Discard computed identifiers.
(Git.Cache._fill_branch): Compute identifiers for each copy of a branch.
(Git.Cache._branch_point): Determine a branch point from its position on the default branch, only identifiers on the default branch are branch points.
(Git.Cache._identifier_for):
(Git.Cache._search): Compute identifiers one branch at a time until a commit is found.
(Git.Cache._fill): Compute identifiers for a single remote's copy of a branch.
(Git.Cache.populate): Update every canonical copy of a branch, populating the default branch for branches we don't cache.
(Git.Cache._history_through): Find history shared with another copy of a branch.
(Git.Cache._populate): Walk a remote branch, skipping the walk if another copy already contains the tip. Fail if a branch intersects with itself without shared history. Never abbreviate commit hashes.
(Git.Cache._populate._append): Match branch names exactly.
(Git.Cache._lookup): Find an identifier on any copy of a branch.
(Git.Cache.to_hash): Use _lookup.
(Git.Cache.to_revision): Ditto.
(Git.Cache.to_identifier): Use _search.
(Git): Define the default remote before constructing the cache.
(Git.default_branch): Fall back to 'main' instead of None.
(Git.commit): Never abbreviate commit hashes.
(Git.commits): Ditto.
(Git.find): The default branch can no longer be None.
(Git.rebase): Local branches are no longer cached.
(Git.pull): Ditto.
(Git.remote_for):
(Git.Cache.populate._append): Deleted.
(Git.Cache.clear): Deleted.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
(resolve_all_commits): Handle remote refs moved by update-ref.
(rev_list.resolve): Resolve remote refs by the branch they name.
(rev_list): Use resolve.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/scm_base.py:
(ScmBase.default_branch): The default branch can no longer be None.
(ScmBase.branch_priority): Sort key used to canonicalize commits.
(ScmBase.prioritize_branches): Use branch_priority.
(ScmBase.find): The default branch can no longer be None.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
(TestGit.test_log):
(test_remote_for_default_branch):
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/scm_unittest.py:
(TestScm.test_prod_branches):
(TestScm):
(TestScm._Repository):
(TestScm.test_branch_priority):
(TestScm.test_branch_priority_sorted):
(TestScm.test_prioritize_branches):
(TestScm.test_prioritize_branches_preferred):

Canonical link: https://commits.webkit.org/325941@main
@webkit-commit-queue
webkit-commit-queue force-pushed the eng/webkitscmpy-cache-canonical-branches branch from 1d38c4d to 064aa09 Compare November 6, 2026 17:13
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 325941@main (064aa09): https://commits.webkit.org/325941@main

Reviewed commits have been landed. Closing PR #77838 and removing active labels.

@webkit-commit-queue
webkit-commit-queue merged commit 064aa09 into WebKit:main Nov 6, 2026
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tools / Tests Tools in the Tools directory, build issues, test infrastructure, and bugs in test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants