graviti.manager.branch
#
The implementation of the Branch and BranchManager.
Module Contents#
Classes#
This class defines the structure of a branch. |
|
This class defines the operations on the branch in Graviti. |
- class graviti.manager.branch.Branch(dataset, name, commit_id)[source]#
Bases:
graviti.manager.commit.NamedCommit
This class defines the structure of a branch.
- Parameters
dataset (graviti.manager.dataset.Dataset) – Class
Dataset
instance.name (str) – The name of the branch.
commit_id (Optional[str]) – The commit id.
- class graviti.manager.branch.BranchManager(dataset)[source]#
This class defines the operations on the branch in Graviti.
- Parameters
dataset (graviti.manager.dataset.Dataset) –
Dataset
instance.
- create(self, name, revision=CURRENT_COMMIT)[source]#
Create a branch.
- Parameters
name (str) – The branch name.
revision (str) – The information to locate the specific commit, which can be the commit id, the branch name, or the tag name. The default value is the current commit of the dataset.
- Raises
NoCommitsError – When create branches on default branch without commit history.
- Returns
The
Branch
instance with the given name.- Return type
- get(self, name)[source]#
Get the branch with the given name.
- Parameters
name (str) – The required branch name.
- Raises
ResourceNameError – When the given name is an empty string.
- Returns
The
Branch
instance with the given name.- Return type
- list(self)[source]#
List the information of branches.
- Returns
The LazyPagingList of
branches
instances.- Return type
- delete(self, name)[source]#
Delete a branch.
- Parameters
name (str) – The name of the branch to be deleted.
- Raises
ResourceNameError – When the given name is an empty string.
- Return type
None