graviti.manager.commit
#
The implementation of the Commit and CommitManager.
Module Contents#
Classes#
This class defines the structure of a commit. |
|
This class defines the structure of a named commit. |
|
This class defines the operations on the commit in Graviti. |
- class graviti.manager.commit.Commit(dataset, commit_id, parent_commit_id, title, description, committer, committed_at)[source]#
Bases:
graviti.manager.sheets.Sheets
,tensorbay.utility.AttrsMixin
This class defines the structure of a commit.
- Parameters
dataset (graviti.manager.dataset.Dataset) – Class
Dataset
instance.commit_id (str) – The commit id.
parent_commit_id (Optional[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.
- to_pyobj(self)[source]#
Dump the instance to a python dict.
- Returns
A python dict containing all the information of the commit:
{ "commit_id": <str> "parent_commit_id": <Optional[str]> "title": <str> "description": <str> "committer": <str> "committed_at": <str> }
- Return type
Dict[str, str]
- search(self, sheet, criteria, schema=None)[source]#
Create a search.
- Parameters
sheet (str) – The sheet name.
criteria (Dict[str, Any]) – The criteria of search.
schema (Optional[graviti.portex.PortexRecordBase]) – The schema of the search result DataFrame.
- Raises
NoCommitsError – When there is no commit on the current branch.
- Returns
The created
DataFrame
instance.- Return type
graviti.dataframe.DataFrame
- class graviti.manager.commit.NamedCommit(dataset, name, commit_id, parent_commit_id, title, description, committer, committed_at)[source]#
Bases:
Commit
This class defines the structure of a named commit.
NamedCommit
is the base class ofBranch
andTag
.- Parameters
dataset (graviti.manager.dataset.Dataset) – Class
Dataset
instance.name (str) – The name of the named commit.
commit_id (Optional[str]) – The commit id.
parent_commit_id (Optional[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.
- to_pyobj(self)[source]#
Dump the instance to a python dict.
- Returns
A python dict containing all the information of the named commit:
{ "name": <str> "commit_id": <Optional[str]> "parent_commit_id": <Optional[str]> "title": <str> "description": <str> "committer": <str> "committed_at": <str> }
- Return type
Dict[str, str]
- class graviti.manager.commit.CommitManager(dataset)[source]#
This class defines the operations on the commit in Graviti.
- Parameters
dataset (graviti.manager.dataset.Dataset) –
Dataset
instance.
- get(self, revision=CURRENT_COMMIT)[source]#
Get the certain commit with the given revision.
- Parameters
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 revision is not given and the commit id of current dataset is None, or when the given branch has no commit history yet.
- Returns
The
Commit
instance with the given revision.- Return type
- list(self, revision=CURRENT_COMMIT)[source]#
List the commits.
- Parameters
revision (str) – The information to locate the specific commit, which can be the commit id, the branch name, or the tag name. If it is given, list the commits before the given commit. If it is not given, list the commits before the current commit.
- Returns
The LazyPagingList of
commits
instances.- Return type