This repository was archived by the owner on Sep 30, 2024. It is now read-only.
batches: retain external fork name#47397
Merged
Merged
Conversation
BolajiOlajide
approved these changes
Feb 9, 2023
adeola-ak
approved these changes
Feb 13, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes https://github.com/sourcegraph/sourcegraph/issues/46096.
Closes https://github.com/sourcegraph/sourcegraph/issues/47362.
Don't be alarmed at the huge file diff, it's probably 75% changes to tests and golden test data. Because if this whole forks exercise taught me anything, it's that I know nothing about forks, and tests help me figure out what's even supposed to happen. 😅
To walk you through the changes here at a high level, this PR accomplishes 3 primary things:
external_fork_namefor changesets created on Bitbucket Server and Bitbucket Cloud with an OOB migration.external_fork_namefrom information available in a changeset'smetadata. This is not possible with the existing metadata for changesets on GitHub/GitLab.external_fork_namefor GitHub and GitLab changesets the next time they are synced, because we also...external_fork_namewhen handling changeset metadata for future changesets, inSetMetadataLoadtoOpentoMergetoComment, meaning we'll catch any updates to the fork repo names (including ones on GitHub and GitLab) the very next time the changeset is synced, which is often immediately after Sourcegraph starts up and the background worker queues a sync.Repowith our GraphQL requests.external_fork_namewhen retrieving the fork repo for future requestsSourceinterface for getting the fork:GetUserForkandGetNamespaceFork. But the purpose of their differentiation was fuzzy and mostly to separate default behavior before a changeset has been created to specific behavior after it's already been published to a fork. This fuzzy differentiation was partially responsible for the bug with updating changesets on Forks on GitHub ( https://github.com/sourcegraph/sourcegraph/issues/47362). I've simplified the interface to just one method,GetFork, which takes a fork namespace and name as optional parameters. This vastly simplifies the logic for retrieving the remote repo for a changeset.Source,DefaultForkName, for the fork name if we're creating a new fork.Beyond this, almost everything else is updating or adding tests.
Random other things I threw in this PR
Test plan
LET ME TELL YOU.