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, parent_commit_id, title, description, committer, committed_at)[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 (str) – The commit id.
parent_commit_id (str) – The parent commit id.
title (str) – The commit title.
description (str) – The commit description.
committer (str) – The commit user.
committed_at (str) – The time when the draft is committed.
- 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=None)[source]#
Create a branch.
- Parameters
name (str) – The branch name.
revision (Optional[str]) – The information to locate the specific commit, which can be the commit id, the branch name, or the tag name. If the revision is not given, create the branch based on the current commit.
- 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
ResourceNotExistError – 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
ResourceNotExistError – When the given name is an empty string.
- Return type
None