Interface NodeStoreBranch
-
public interface NodeStoreBranch
An instance of this class represents a private branch of the tree in aNodeStore
to which transient changes can be applied and later merged back or discarded.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull NodeState
getBase()
Returns the base state of this branch.@NotNull NodeState
getHead()
Returns the head state of this branch.@NotNull NodeState
merge(@NotNull CommitHook hook, @NotNull CommitInfo info)
Merges the changes in this branch to the main content tree.void
rebase()
Rebase the changes from this branch on top of the current root.void
setRoot(NodeState newRoot)
Updates the state of the content tree of this private branch.
-
-
-
Method Detail
-
getBase
@NotNull @NotNull NodeState 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
@NotNull @NotNull NodeState 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:
java.lang.IllegalStateException
- if the branch is already merged
-
setRoot
void setRoot(NodeState newRoot)
Updates the state of the content tree of this private branch.- Parameters:
newRoot
- new root node state- Throws:
java.lang.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 failedjava.lang.IllegalStateException
- if the branch is already merged
-
rebase
void rebase()
Rebase the changes from this branch on top of the current root.
-
-