Interface NodeStoreBranch
public interface NodeStoreBranch
An instance of this class represents a private branch of the tree in a
NodeStore to which transient changes can be applied and later merged
back or discarded.-
Method Summary
Modifier and TypeMethodDescription@NotNull NodeStategetBase()Returns the base state of this branch.@NotNull NodeStategetHead()Returns the head state of this branch.@NotNull NodeStatemerge(@NotNull CommitHook hook, @NotNull CommitInfo info) Merges the changes in this branch to the main content tree.voidrebase()Rebase the changes from this branch on top of the current root.voidUpdates the state of the content tree of this private branch.
-
Method Details
-
getBase
Returns the base state of this branch. The base state is the state of the tree as it was at the time this branch was created.- Returns:
- root node state
-
getHead
Returns the head state of this branch. The head state is the state resulting from the base state by applying all subsequent modifications to this branch bysetRoot(NodeState).- Returns:
- root node state
- Throws:
IllegalStateException- if the branch is already merged
-
setRoot
Updates the state of the content tree of this private branch.- Parameters:
newRoot- new root node state- Throws:
IllegalStateException- if the branch is already merged
-
merge
@NotNull @NotNull NodeState merge(@NotNull @NotNull CommitHook hook, @NotNull @NotNull CommitInfo info) throws CommitFailedException Merges the changes in this branch to the main content tree. Merging is done by rebasing the changes in this branch on top of the current head revision followed by a fast forward merge.- Parameters:
hook- the commit hook to apply while merging changesinfo- commit info associated with this merge operation- Returns:
- the node state resulting from the merge.
- Throws:
CommitFailedException- if the merge failedIllegalStateException- if the branch is already merged
-
rebase
void rebase()Rebase the changes from this branch on top of the current root.
-