ts-playground
    Preparing search index...

    Core class

    • Core of ObjectVersionControl class
    • This class is a version control system for objects. Like Git, it stores snapshots and commits.
    • Core only has the core features of ObjectVersionControl.
      • commit
      • snapshot
    • Core class doesn't have HEAD, Remote, Sync features.

    Type Parameters

    • T
    Index

    Methods

    • Commit a snapshot Commit the given data. The commit is derived from the current head.

      Parameters

      • data: T

        The data to commit

      • parents: string[]

      Returns string

      The hash value of the commit

    • Create a commit with the given targets and data This method creates a commit with multiple parents. In most cases, it is easier to use the commit() method.

      Parameters

      • parents: string[]

        The hashes of the parent commits

      • data: T

        The data to commit

      Returns string

      The hash value of the commit

    • Find the ancestor commit hashes within the target and the base

      Parameters

      • target: string

        The hash of the target commit

      • base: null | string

        The hash of the base commit

      Returns string[]

      An array of hash values of the ancestor commits

    • Get the data of a snapshot by its hash

      Parameters

      • hash: string

        The hash of the snapshot

      Returns T

      The data of the snapshot

    • Get the data of a snapshot by the commit hash

      Parameters

      • hash: string

        The hash of the commit

      Returns T

      The data of the snapshot

    • Get sync items between the target and the base

      Parameters

      • target: string

        Hash value of the target commit

      • base: null | string

        Hash value of the base commit

      Returns SyncItems<T>

      SyncItems {commits, snapshots}

    • Verify all snapshots and commits in the repository This is equivalent to git fsck in Git if any snapshot or commit is invalid, this method returns false

      Returns boolean

      True if all snapshots and commits are valid