Version Control#

apsync.toggle_version_control(path: str, enable: bool) None#

Toggles incremental version control for the folder that ‘path’ points to. Pass enable=True to enable version control, pass enable=False to disable it.

Parameters
  • path (str) – The path to the folder

  • enable (bool) – Whether version control should be enabled or disabled

Examples

Enable version control on a folder:
>>> apsync.toggle_version_control("my/asset/folder", True)
Check whether or not version control is enabled on a folder:
>>> folder = apsync.get_folder("my/asset/folder")
>>> if folder: print(folder.versioning_enabled)
True
apsync.comment_file(file_path: str, comment: Optional[str]) None#

Adds a comment by the current user to the file identified by file_path.

Parameters
  • file_path (str) – The path to the file

  • comment (Optional[str]) – The comment to put on the file

Example

>>> apsync.comment_file(file_path, "This is a nice file")
apsync.create_next_version(file_path: str) str#

Creates a new incremental version of file_path.

Parameters

file_path (str) – The path to the file

Returns

The path to the newly created file

Example

>>> apsync.create_next_version("monkey_v001.blend")
monkey_v002.blend
apsync.get_next_version_path(file_path: str) str#

Returns the path of the file that is used when running create new version

Parameters

file_path (str) – The path to the file

Returns

The file path

Example

>>> apsync.get_next_version_path("monkey_v001.blend")
monkey_v002.blend
apsync.get_versioned_object(file_path: str) Optional[apsync.VersionedObject]#

Returns the VersionedObject for a given file_path - or None if the given path is not part of a VersionedObject or if version control is disabled on the folder.

Parameters

file_path (str) – The path to (any) file of the incremental sequence

Examples

Iterate over all versions of a VersionedObject and print the path:
>>> versioned_object = apsync.get_versioned_object(file_path)
>>> if versioned_object:
>>>     for version in versioned_object.versions:
>>>         print(version.path)
class apsync.VersionedObject#

The VersionedObject identifies a list of files as a collection of versions. For this, a VersionedObject stores a list of files (versions) and how they are related (ancestor_id and version_number). Each Version stores the FileObject id (object_id) in addition to metadata such as a comment and author.

id#

The id of the VersionedObject

Type

str

workspace_id#

The id of the associated workspace

Type

str

path#

The absolute path of the base file

Type

str

basename#

The stripped basename of a VersionedObject. The basename of monkey_v01.blend is monkey.blend, for example

Type

str

versions#

The list of Version

Type

list

class apsync.Version#

The Version identifies a versioned file within a VersionedObject. A Version object stores the unique version_number and path to the file. In addition, metadata such as comments and author are provided.

id#

The id of the Version

Type

str

workspace_id#

The id of the associated workspace

Type

str

path#

The absolute path to the file

Type

str

version_number#

The version number

Type

int

comment#

An optional comment provided by an author

Type

Optional[str]

author#

The optional author of the version

Type

Optional[str]

date#

The optional date when the version was created in seconds since the epoch

Type

Optional[int]