class BaseRepo(object):
Known subclasses: dulwich.contrib.swift.SwiftRepo
, dulwich.repo.MemoryRepo
, dulwich.repo.Repo
Base class for a git repository.
This base class is meant to be used for Repository implementations that e.g. work on top of a different transport than a standard filesystem path.
Method | __contains__ |
Check if a specific Git object or ref is present. |
Method | __delitem__ |
Remove a ref. |
Method | __getitem__ |
Retrieve a Git object by SHA1 or ref. |
Method | __init__ |
Open a repository. |
Method | __setitem__ |
Set a ref. |
Method | do |
Create a new commit. |
Method | fetch |
Fetch objects into another repository. |
Method | fetch |
Fetch the missing objects required for a set of revisions. |
Method | fetch |
Fetch the pack data required for a set of revisions. |
Method | generate |
Generate pack data objects for a set of wants/haves. |
Method | get |
Retrieve the config object. |
Method | get |
Return a config stack for this repository. |
Method | get |
Retrieve the description for this repository. |
Method | get |
Retrieve a graph walker. |
Method | get |
Get a file from the control dir with a specific name. |
Method | get |
Retrieve the object with the specified SHA. |
Method | get |
Retrieve the parents of a specific commit. |
Method | get |
Get the peeled value of a ref. |
Method | get |
Get dictionary with all refs. |
Method | get |
Get the set of shallow commits. |
Method | get |
Obtain a walker for this repository. |
Method | head |
Return the SHA1 pointed at by HEAD. |
Method | open |
Open the index for this repository. |
Method | parents |
Undocumented |
Method | set |
Set the description for this repository. |
Method | update |
Update the list of shallow objects. |
Instance Variable | hooks |
Undocumented |
Instance Variable | object |
Dictionary-like object for accessing the objects |
Instance Variable | refs |
Dictionary-like object with the refs in this repository |
Method | _add |
Add or modify graftpoints |
Method | _del |
Delete a file in the control directory with the given name. |
Method | _determine |
Probe the file-system to determine whether permissions can be trusted. |
Method | _get |
Undocumented |
Method | _get |
Determine the identity to use for new commits. |
Method | _init |
Initialize a default set of named files. |
Method | _put |
Write a file to the control dir with the given name and contents. |
Method | _read |
Undocumented |
Method | _remove |
Remove graftpoints |
Instance Variable | _graftpoints |
Undocumented |
Open a repository.
This shouldn't be called directly, but rather through one of the base classes, such as MemoryRepo or Repo.
Parameters | |
objectBaseObjectStore | Object store to use |
refs:RefsContainer | Refs container to use |
Create a new commit.
If not specified, committer and author default to get_user_identity(..., 'COMMITTER') and get_user_identity(..., 'AUTHOR') respectively.
Parameters | |
message:Optional[ | Commit message |
committer:Optional[ | Committer fullname |
author:Optional[ | Author fullname |
commit | Commit timestamp (defaults to now) |
commit | Commit timestamp timezone (defaults to GMT) |
author | Author timestamp (defaults to commit timestamp) |
author | Author timestamp timezone (defaults to commit timestamp timezone) |
tree:Optional[ | SHA1 of the tree root to use (if not specified the current index will be committed). |
encoding:Optional[ | Encoding |
ref:Ref | Optional ref to commit to (defaults to current branch) |
mergeOptional[ | Merge heads (defaults to .git/MERGE_HEAD) |
nobool | Skip pre-commit and commit-msg hooks |
sign:bool | GPG Sign the commit (bool, defaults to False, pass True to use default GPG key, pass a str containing Key ID to use a specific GPG key) |
Returns | |
New commit SHA1 |
Fetch objects into another repository.
Returns: The local refs
Parameters | |
target | The target repository |
determine | Optional function to determine what refs to fetch. |
progress | Optional progress function |
depth | Optional shallow fetch depth |
Fetch the missing objects required for a set of revisions.
Returns: iterator over objects, with __len__ implemented
Parameters | |
determine | Function that takes a dictionary with heads and returns the list of heads to fetch. |
graph | Object that can iterate over the list of revisions to fetch and has an "ack" method that will be called to acknowledge that a revision is present. |
progress | Simple progress function that will be called with updated progress strings. |
get | Function that returns a dict of pointed-to sha -> tag sha for including tags. |
depth | Shallow fetch depth |
Fetch the pack data required for a set of revisions.
Returns: count and iterator over pack data
Parameters | |
determine | Function that takes a dictionary with heads and returns the list of heads to fetch. |
graph | Object that can iterate over the list of revisions to fetch and has an "ack" method that will be called to acknowledge that a revision is present. |
progress | Simple progress function that will be called with updated progress strings. |
get | Function that returns a dict of pointed-to sha -> tag sha for including tags. |
depth | Shallow fetch depth |
Generate pack data objects for a set of wants/haves.
Parameters | |
have:List[ | List of SHA1s of objects that should not be sent |
want:List[ | List of SHA1s of objects that should be sent |
progress:Optional[ | Optional progress reporting method |
ofsOptional[ | Whether OFS deltas can be included |
dulwich.repo.MemoryRepo
, dulwich.repo.Repo
Retrieve the config object.
Returns: ConfigFile
object for the .git/config file.
Returns | |
ConfigFile | Undocumented |
Return a config stack for this repository.
This stack accesses the configuration for both this repository itself (.git/config) and the global configuration, which usually lives in ~/.gitconfig.
Returns: Config
instance for this repository
Returns | |
StackedConfig | Undocumented |
dulwich.repo.MemoryRepo
, dulwich.repo.Repo
Retrieve the description for this repository.
- Returns: String with the description of the repository
- as set by the user.
Retrieve a graph walker.
A graph walker is used by a remote repository (or proxy) to find out which objects are present in this repository.
Returns: A graph walker object
Parameters | |
heads:Optional[ | Repository heads to use (optional) |
Returns | |
ObjectStoreGraphWalker | Undocumented |
dulwich.repo.MemoryRepo
, dulwich.repo.Repo
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.
Returns: An open file object, or None if the file does not exist.
Parameters | |
path:str | The path to the file, relative to the control dir. |
Returns | |
Optional[ | Undocumented |
Retrieve the parents of a specific commit.
If the specific commit is a graftpoint, the graft parents will be returned instead.
Returns: List of parents
Parameters | |
sha:bytes | SHA of the commit for which to retrieve the parents |
commit:Optional[ | Optional commit matching the sha |
Returns | |
List[ | Undocumented |
Get the peeled value of a ref.
- Returns: The fully-peeled SHA1 of a tag object, after peeling all
- intermediate tags; if the original ref does not point to a tag, this will equal the original SHA1.
Parameters | |
ref:Ref | The refname to peel. |
Returns | |
ObjectID | Undocumented |
Obtain a walker for this repository.
Returns: A Walker
object
Parameters | |
include:Optional[ | Iterable of SHAs of commits to include along with their ancestors. Defaults to [HEAD] |
*args | Undocumented |
**kwargs | Undocumented |
exclude | Iterable of SHAs of commits to exclude along with their ancestors, overriding includes. |
order | ORDER_* constant specifying the order of results. Anything other than ORDER_DATE may result in O(n) memory usage. |
reverse | If True, reverse the order of output, requiring O(n) memory. |
max | The maximum number of entries to yield, or None for no limit. |
paths | Iterable of file or subtree paths to show entries for. |
rename | diff.RenameDetector object for detecting renames. |
follow | If True, follow path across renames/copies. Forces a default rename_detector. |
since | Timestamp to list commits after. |
until | Timestamp to list commits before. |
queue | A class to use for a queue of commits, supporting the iterator protocol. The constructor takes a single argument, the Walker. |
dulwich.repo.MemoryRepo
, dulwich.repo.Repo
Open the index for this repository.
Returns: The matching Index
Returns | |
Index | Undocumented |
Raises | |
NoIndexPresent | If no index is present |
dulwich.repo.MemoryRepo
, dulwich.repo.Repo
Set the description for this repository.
Parameters | |
description | Text to set as description for this repository. |
Update the list of shallow objects.
Parameters | |
new | Newly shallow objects |
new | Newly no longer shallow objects |
dulwich.repo.MemoryRepo
, dulwich.repo.Repo
Delete a file in the control directory with the given name.
Parameters | |
path:str | Undocumented |
Probe the file-system to determine whether permissions can be trusted.
Returns: True if permissions can be trusted, False otherwise.
Returns | |
bool | Undocumented |
Determine the identity to use for new commits.
Parameters | |
config:StackedConfig | Undocumented |
kind:Optional[ | Undocumented |
Returns | |
bytes | Undocumented |