dulwich.repo.Repo(BaseRepo)
class documentationdulwich.repo
(View In Hierarchy)
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 |
Open a repository.
This shouldn't be called directly, but rather through one of the base classes, such as MemoryRepo or Repo.
Parameters | object_store | Object store to use |
refs | Refs container to use |
Iterate parent directories to discover a repository
Return a Repo object for the first parent directory that looks like a Git repository.
Parameters | start | The directory to start discovery from (defaults to '.') |
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.
Returns | True if permissions can be trusted, False otherwise. |
Parameters | path | The path to the file, relative to the control dir. |
contents | A string to write to the file. |
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.
Parameters | path | The path to the file, relative to the control dir. |
basedir | Optional argument that specifies an alternative to the control dir. | |
Returns | An open file object, or None if the file does not exist. |
Returns | The matching Index | |
Raises | NoIndexPresent | If no index is present |
Parameters | fs_paths | List of paths, relative to the repository path |
Parameters | target_path | Target path |
mkdir | Create the target directory | |
bare | Whether to create a bare repository | |
origin | Base name for refs in target repository cloned from this repository | |
Returns | Created repository as Repo |
Parameters | tree | Tree SHA to reset to, None for current HEAD tree. |
Returns | ConfigFile object for the .git/config file. |
Returns | A string describing the repository or None. |
Parameters | description | Text to set as description for this repository. |
Parameters | path | Path in which to create the repository |
mkdir | Whether to create the directory | |
Returns | Repo instance |
Parameters | path | Path in which to create the working tree. |
main_repo | Main repository to reference | |
identifier | Worktree identifier | |
mkdir | Whether to create the directory | |
Returns | Repo instance |
Create a new bare repository.
path should already exist and be an empty directory.
Parameters | path | Path to create bare repository in |
Returns | a Repo instance |