dulwich.repo.BaseRepo(object)
class documentationdulwich.repo
(View In Hierarchy)
Known subclasses: dulwich.contrib.swift.SwiftRepo, dulwich.repo.MemoryRepo, dulwich.repo.Repo
Instance Variable | object_store | Dictionary-like object for accessing the objects |
Instance Variable | refs | Dictionary-like object with the refs in this repository |
Method | __init__ | Open a repository. |
Method | get_named_file | Get a file from the control dir with a specific name. |
Method | open_index | Open the index for 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 | Retrieve the config object. |
Method | get_description | Retrieve the description for this repository. |
Method | set_description | Set the description for this repository. |
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 | _determine_file_mode | Probe the file-system to determine whether permissions can be trusted. |
Method | _init_files | Initialize a default set of named files. |
Method | _put_named_file | Write a file to the control dir with the given name and contents. |
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 |
Returns | True if permissions can be trusted, False otherwise. |
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. |
Returns | An open file object, or None if the file does not exist. |
Parameters | path | The path to the file, relative to the control dir. |
contents | A string to write to the file. |
Returns | The matching Index | |
Raises | NoIndexPresent | If no index is present |
Parameters | target | The target repository |
determine_wants | Optional function to determine what refs to fetch. | |
progress | Optional progress function | |
depth | Optional shallow fetch depth | |
Returns | The local refs |
Parameters | determine_wants | Function that takes a dictionary with heads and returns the list of heads to fetch. |
graph_walker | 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_tagged | Function that returns a dict of pointed-to sha -> tag sha for including tags. | |
depth | Shallow fetch depth | |
Returns | count and iterator over pack data |
Parameters | determine_wants | Function that takes a dictionary with heads and returns the list of heads to fetch. |
graph_walker | 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_tagged | Function that returns a dict of pointed-to sha -> tag sha for including tags. | |
depth | Shallow fetch depth | |
Returns | iterator over objects, with __len__ implemented |
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.
Parameters | heads | Repository heads to use (optional) |
Returns | A graph walker object |
Parameters | sha | SHA to retrieve |
Returns | A ShaFile object | |
Raises | KeyError | when the object can not be found |
Retrieve the parents of a specific commit.
If the specific commit is a graftpoint, the graft parents will be returned instead.
Parameters | sha | SHA of the commit for which to retrieve the parents |
commit | Optional commit matching the sha | |
Returns | List of parents |
Returns | ConfigFile object for the .git/config file. |
Returns | String with the description of the repository as set by the user. |
Parameters | description | Text to set as description for this repository. |
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 |
Parameters | new_shallow | Newly shallow objects |
new_unshallow | Newly no longer shallow objects |
Parameters | ref | The refname to peel. |
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 | include | Iterable of SHAs of commits to include along with their ancestors. Defaults to [HEAD] |
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_entries | The maximum number of entries to yield, or None for no limit. | |
paths | Iterable of file or subtree paths to show entries for. | |
rename_detector | 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_cls | A class to use for a queue of commits, supporting the iterator protocol. The constructor takes a single argument, the Walker. | |
Returns | A Walker object |
Parameters | name | A Git object SHA1 or a ref name |
Returns | A ShaFile object, such as a Commit or Blob | |
Raises | KeyError | when the specified ref or object does not exist |
Parameters | name | Git object SHA1 or ref name |
Parameters | name | ref name |
value | Ref value - either a ShaFile object, or a hex sha |
Parameters | updated_graftpoints | Dict of commit shas to list of parent shas |
Parameters | to_remove | List of commit shas |
Parameters | message | Commit message |
committer | Committer fullname | |
author | Author fullname (defaults to committer) | |
commit_timestamp | Commit timestamp (defaults to now) | |
commit_timezone | Commit timestamp timezone (defaults to GMT) | |
author_timestamp | Author timestamp (defaults to commit timestamp) | |
author_timezone | Author timestamp timezone (defaults to commit timestamp timezone) | |
tree | SHA1 of the tree root to use (if not specified the current index will be committed). | |
encoding | Encoding | |
ref | Optional ref to commit to (defaults to current branch) | |
merge_heads | Merge heads (defaults to .git/MERGE_HEADS) | |
Returns | New commit SHA1 |