The version control is based on the :ref:`reference/glossary:draft` and :ref:`reference/glossary:commit`.
Similar with Git, a :ref:`reference/glossary:commit` is a version of a dataset, which contains the changes compared with the former commit.
Unlike Git, a :ref:`reference/glossary:draft` is a new concept which represents a workspace in which changing the dataset is allowed.
In TensorBay SDK, the dataset client supplies the function of version control.
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """Authorize a Dataset Client Instance""" :end-before: """"""
TensorBay SDK supports creating the draft straightforwardly, which is based on the current branch. Note that currently there can be only one open draft in each branch.
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """Create Draft""" :end-before: """"""
Then the dataset client will change the status to "draft" and store the draft number. The draft number will be auto-increasing every time a draft is created.
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """Draft Number Will Be Stored""" :end-before: """"""
Also, TensorBay SDK supports creating a draft based on a given branch.
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """Create Draft on a Branch""" :end-before: """"""
The draft number can be found through listing drafts.
status
includes "OPEN", "CLOSED", "COMMITTED" and None where None means listing drafts in all status.
branch_name
refers to the branch name of the draft to be listed.
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """List Drafts""" :end-before: """"""
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """Get Draft""" :end-before: """"""
After the commit, the draft will be closed.
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """Commit Draft""" :end-before: """"""
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """Get Commit""" :end-before: """"""
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """List Commits""" :end-before: """"""
.. literalinclude:: ../../../../docs/code/draft_and_commit.py :language: python :start-after: """Checkout""" :end-before: """"""
Note
Here, :ref:`reference/glossary:revision` is the information to locate the specific commit, which can be the commit id, the branch, or the tag.