-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f80504f
commit a979784
Showing
3 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright 2021 Graviti. Licensed under MIT License. | ||
# | ||
|
||
# pylint: disable=wrong-import-position | ||
# pylint: disable=wrong-import-order | ||
# pylint: disable=not-callable | ||
# pylint: disable=ungrouped-imports | ||
# pylint: disable=import-error | ||
# pylint: disable=pointless-string-statement | ||
# pylint: disable=invalid-name | ||
|
||
|
||
"""This file includes the python code of tag.rst.""" | ||
|
||
"""Authorize a Dataset Client Instance""" | ||
from tensorbay import GAS | ||
|
||
ACCESS_KEY = "Accesskey-*****" | ||
gas = GAS(ACCESS_KEY) | ||
dataset_client = gas.create_dataset("DatasetName") | ||
dataset_client.create_draft("draft-1") | ||
dataset_client.commit("commit-1", tag="V1") | ||
commit_id_1 = dataset_client.status.commit_id | ||
|
||
dataset_client.create_draft("draft-2") | ||
dataset_client.commit("commit-2", tag="V2") | ||
commit_id_2 = dataset_client.status.commit_id | ||
|
||
"""""" | ||
|
||
"""Create Branch""" | ||
dataset_client.create_branch("T123") | ||
"""""" | ||
|
||
"""Branch Name Will Be Stored""" | ||
branch_name = dataset_client.status.branch_name | ||
# branch_name = "T123" | ||
"""""" | ||
|
||
"""Create Branch Based On a Revision""" | ||
dataset_client.create_branch("T123", revision=commit_id_2) | ||
dataset_client.create_branch("T123", revision="V2") | ||
dataset_client.create_branch("T123", revision="main") | ||
"""""" | ||
|
||
"""Create Branch Based On a Former Commit""" | ||
dataset_client.create_branch("T1234", revision=commit_id_1) | ||
dataset_client.create_branch("T1234", revision="V1") | ||
"""""" | ||
|
||
"""Create and Commit Draft""" | ||
dataset_client.create_draft("draft-3") | ||
dataset_client.commit("commit-3", tag="V3") | ||
"""""" | ||
|
||
"""List Branches""" | ||
branches = dataset_client.list_branches() | ||
"""""" | ||
|
||
"""Get a Branch""" | ||
branch = dataset_client.get_branch("T123") | ||
"""""" | ||
|
||
"""Delete a Branch""" | ||
dataset_client.delete_branch("T123") | ||
"""""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
######## | ||
Branch | ||
######## | ||
|
||
TensorBay supports diverging from the main line of development and continue | ||
to do work without messing with that main line. Like Git, the way Tensorbay branches is incredibly lightweight, | ||
making branching operations nearly instantaneous, and switching back and forth between branches generally just as fast. | ||
Tensorbay encourages workflows that branch often, even multiple times in a day. | ||
|
||
Before operating branches, a dataset client instance with existing commit is needed. | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """Authorize a Dataset Client Instance""" | ||
:end-before: """""" | ||
|
||
************** | ||
Create Branch | ||
************** | ||
|
||
TensorBay SDK supports creating the branch straightforwardly, which is based on the current commit. | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """Create Branch""" | ||
:end-before: """""" | ||
|
||
Then the dataset client will storage the branch name. "main" is the default branch. | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """Branch Name Will Be Stored""" | ||
:end-before: """""" | ||
|
||
Also, creating a branch based on a revision is allowed. | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """Create Branch Based On a Revision""" | ||
:end-before: """""" | ||
|
||
Specially, creating a branch based on a former commit is permitted. | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """Create Branch Based On a Former Commit""" | ||
:end-before: """""" | ||
|
||
Then, through creating and committing the draft | ||
based on the branch, diverging from the current line of development can be realized. | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """Create and Commit Draft""" | ||
:end-before: """""" | ||
|
||
************** | ||
List Branches | ||
************** | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """List Branches""" | ||
:end-before: """""" | ||
|
||
*********** | ||
Get Branch | ||
*********** | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """Get a Branch""" | ||
:end-before: """""" | ||
|
||
************** | ||
Delete Branch | ||
************** | ||
|
||
.. literalinclude:: ../../../docs/code/branch.py | ||
:language: python | ||
:start-after: """Delete a Branch""" | ||
:end-before: """""" |