Skip to main content

BranchableTree Interface

A "version control"-style branch of a SharedTree.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

For more information about our API support guarantees, see here.

Signature

/** @sealed */
export interface BranchableTree extends ViewableTree

Extends: ViewableTree

Remarks

Branches may be used to coordinate edits to a SharedTree, e.g. via merge and rebase operations. Changes applied to a branch of a branch only apply to that branch and are isolated from other branches. Changes may be synchronized across branches via merge and rebase operations provided on the branch object.

Methods

Method Alerts Return Type Description
branch() Alpha TreeBranchFork Spawn a new branch which is based off of the current state of this branch. Any mutations of the new branch will not apply to this branch until the new branch is merged back into this branch via merge().
merge(branch) Alpha void Apply all the new changes on the given branch to this branch.
merge(branch, disposeMerged) Alpha void Apply all the new changes on the given branch to this branch.
rebase(branch) Alpha void Rebase the given branch onto this branch.

Method Details

branch

Spawn a new branch which is based off of the current state of this branch. Any mutations of the new branch will not apply to this branch until the new branch is merged back into this branch via merge().

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

For more information about our API support guarantees, see here.

Signature

branch(): TreeBranchFork;

Returns

Return type: TreeBranchFork

merge

Apply all the new changes on the given branch to this branch.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

For more information about our API support guarantees, see here.

Signature

merge(branch: TreeBranchFork): void;

Remarks

All ongoing transactions (if any) in branch will be committed before the merge. A "changed" event and a corresponding Revertible will be emitted on this branch for each new change merged from 'branch'.

Parameters

Parameter Type Description
branch TreeBranchFork

merge

Apply all the new changes on the given branch to this branch.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

For more information about our API support guarantees, see here.

Signature

merge(branch: TreeBranchFork, disposeMerged: boolean): void;

Remarks

All ongoing transactions (if any) in branch will be committed before the merge.

Parameters

Parameter Type Description
branch TreeBranchFork a branch which was created by a call to branch().
disposeMerged boolean whether or not to dispose branch after the merge completes.

rebase

Rebase the given branch onto this branch.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

For more information about our API support guarantees, see here.

Signature

rebase(branch: TreeBranchFork): void;

Parameters

Parameter Type Description
branch TreeBranchFork a branch which was created by a call to branch(). It is modified by this operation.