-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clone list of revertibles #23424
base: main
Are you sure you want to change the base?
clone list of revertibles #23424
Conversation
packages/dds/tree/src/test/utils.ts
Outdated
* @param targetBranch - The target branch to clone the revertibles for | ||
* @returns Array of cloned revertibles, maintaining the same order as the input | ||
*/ | ||
export function cloneRevertiblesInBatch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be package exported for users to be able to use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(with the alpha tag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes while you were reviewing 😄. Would you look into this again please?
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
const batchedRevertibles: RevertibleAlpha[] = []; | ||
for (const revertible of undoStack) { | ||
batchedRevertibles.push(revertible); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason not to just do const batchedRevertibles = [...undoStack];
// Check if the original branch and forked branch have a common ancestor. | ||
const originalBranchHead = this.#transaction.activeBranch.getHead(); | ||
const forkedBranchHead = forkedCheckout.#transaction.activeBranch.getHead(); | ||
|
||
assert( | ||
findCommonAncestor(originalBranchHead, forkedBranchHead) !== undefined, | ||
0x576 /* branch A and branch B must be related */, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done in a separate PR, and it should throw a UsageError instead of asserting.
Description
13865
This PR adds a helper function that takes in the list of revertibles and returns the cloned revertibles in order.