A git repository backed by local disk.

To open an existing repository, call the contructor with the path of the repository.

To create a new repository, use the Repo.init class method.

Method __init__ Open a repository.
Class Method discover Iterate parent directories to discover a repository
Method controldir Return the path of the control directory.
Method commondir Return the path of the common directory.
Method get_named_file Get a file from the control dir with a specific name.
Method index_path Return path to the index file.
Method open_index Open the index for this repository.
Method has_index Check if an index is present.
Method stage Stage a set of paths.
Method clone Clone this repository.
Method reset_index Reset the index back to a specific tree.
Method get_config Retrieve the config object.
Method get_description Retrieve the description of this repository.
Method __repr__ Undocumented
Method set_description Set the description for this repository.
Class Method init Create a new repository.
Class Method init_bare Create a new bare repository.
Method close Close any files opened by this repository.
Method __enter__ Undocumented
Method __exit__ Undocumented
Method _write_reflog Undocumented
Method _determine_file_mode Probe the file-system to determine whether permissions can be trusted.
Method _put_named_file Write a file to the control dir with the given name and contents.
Class Method _init_maybe_bare Undocumented
Class Method _init_new_working_directory Create a new working directory linked to a repository.

Inherited from BaseRepo:

Instance Variable object_store Dictionary-like object for accessing the objects
Instance Variable refs Dictionary-like object with the refs in this repository
Method fetch Fetch objects into another repository.
Method fetch_pack_data Fetch the pack data required for a set of revisions.
Method fetch_objects Fetch the missing objects required for a set of revisions.
Method get_graph_walker Retrieve a graph walker.
Method get_refs Get dictionary with all refs.
Method head Return the SHA1 pointed at by HEAD.
Method get_object Retrieve the object with the specified SHA.
Method get_parents Retrieve the parents of a specific commit.
Method get_config_stack Return a config stack for this repository.
Method get_shallow Get the set of shallow commits.
Method update_shallow Update the list of shallow objects.
Method get_peeled Get the peeled value of a ref.
Method get_walker Obtain a walker for this repository.
Method __getitem__ Retrieve a Git object by SHA1 or ref.
Method __contains__ Check if a specific Git object or ref is present.
Method __setitem__ Set a ref.
Method __delitem__ Remove a ref.
Method do_commit Create a new commit.
Method _init_files Initialize a default set of named files.
Method _get_object Undocumented
Method _get_user_identity Determine the identity to use for new commits.
Method _add_graftpoints Add or modify graftpoints
Method _remove_graftpoints Remove graftpoints
def __init__(self, root):

Open a repository.

This shouldn't be called directly, but rather through one of the base classes, such as MemoryRepo or Repo.

Parametersobject_storeObject store to use
refsRefs container to use
def _write_reflog(self, ref, old_sha, new_sha, committer, timestamp, timezone, message):
Undocumented
@classmethod
def discover(cls, start='.'):

Iterate parent directories to discover a repository

Return a Repo object for the first parent directory that looks like a Git repository.

ParametersstartThe directory to start discovery from (defaults to '.')
def controldir(self):
Return the path of the control directory.
def commondir(self):

Return the path of the common directory.

For a main working tree, it is identical to controldir().

For a linked working tree, it is the control directory of the main working tree.

def _determine_file_mode(self):
Probe the file-system to determine whether permissions can be trusted.
ReturnsTrue if permissions can be trusted, False otherwise.
def _put_named_file(self, path, contents):
Write a file to the control dir with the given name and contents.
ParameterspathThe path to the file, relative to the control dir.
contentsA string to write to the file.
def get_named_file(self, path, basedir=None):

Get a file from the control dir with a specific name.

Although the filename should be interpreted as a filename relative to the control dir in a disk-based Repo, the object returned need not be pointing to a file in that location.

ParameterspathThe path to the file, relative to the control dir.
basedirOptional argument that specifies an alternative to the control dir.
ReturnsAn open file object, or None if the file does not exist.
def index_path(self):
Return path to the index file.
def open_index(self):
Open the index for this repository.
ReturnsThe matching Index
RaisesNoIndexPresentIf no index is present
def has_index(self):
Check if an index is present.
def stage(self, fs_paths):
Stage a set of paths.
Parametersfs_pathsList of paths, relative to the repository path
def clone(self, target_path, mkdir=True, bare=False, origin='origin', checkout=None):
Clone this repository.
Parameterstarget_pathTarget path
mkdirCreate the target directory
bareWhether to create a bare repository
originBase name for refs in target repository cloned from this repository
ReturnsCreated repository as Repo
def reset_index(self, tree=None):
Reset the index back to a specific tree.
ParameterstreeTree SHA to reset to, None for current HEAD tree.
def get_config(self):
Retrieve the config object.
ReturnsConfigFile object for the .git/config file.
def get_description(self):
Retrieve the description of this repository.
ReturnsA string describing the repository or None.
def __repr__(self):
Undocumented
def set_description(self, description):
Set the description for this repository.
ParametersdescriptionText to set as description for this repository.
@classmethod
def _init_maybe_bare(cls, path, bare):
Undocumented
@classmethod
def init(cls, path, mkdir=False):
Create a new repository.
ParameterspathPath in which to create the repository
mkdirWhether to create the directory
ReturnsRepo instance
@classmethod
def _init_new_working_directory(cls, path, main_repo, identifier=None, mkdir=False):
Create a new working directory linked to a repository.
ParameterspathPath in which to create the working tree.
main_repoMain repository to reference
identifierWorktree identifier
mkdirWhether to create the directory
ReturnsRepo instance
@classmethod
def init_bare(cls, path, mkdir=False):

Create a new bare repository.

path should already exist and be an empty directory.

ParameterspathPath to create bare repository in
Returnsa Repo instance
def close(self):
Close any files opened by this repository.
def __enter__(self):
Undocumented
def __exit__(self, exc_type, exc_val, exc_tb):
Undocumented
API Documentation for Dulwich, generated by pydoctor at 2018-11-17 19:05:54.