datalad_core.repo

Repository and worktree representations

This module provides the essential types for working with Git/git-annex repositories and DataLad datasets.

For most use cases, the Worktree class is the main entrypoint. It can be pointed to an existing Git repository checkout, or a new repository can be created via its Worktree.init_at() class method. Access to operations on the underlying Git repository (that may be shared by additional worktrees) is possible via the Worktree.repo attribute. An optional (git-)annex can be initialized (Worktree.init_annex()), and accessed via Worktree.annex.

Working with bare Git repositories is supported by using the Repo class directly. Operations on an annex of a bare repository are accessible via the Repo.bare_annex attribute.

The Repo and Worktree classes in this module implement the “flyweight” pattern. This means that, within the same process, creating instances of Repo and Worktree always yields the same instance for the same path location.

Repo(path)

(The bare part of) an existing Git repository

Worktree(path)

Git worktree (checkout)

Annex(path)

Interface for an annex in a non-bare Git repository

BareRepoAnnex(path)

Interface for an annex in a bare Git repository