dulwich.index
module documentationdulwich
Function | pathsplit | Split a /-delimited path into a directory part and a basename. |
Function | pathjoin | Join a /-delimited path. |
Function | read_cache_time | Read a cache time. |
Function | write_cache_time | Write a cache time. |
Function | read_cache_entry | Read an entry from a cache file. |
Function | write_cache_entry | Write an index entry to a file. |
Function | read_index | Read an index file, yielding the individual entries. |
Function | read_index_dict | Read an index file and return it as a dictionary. |
Function | write_index | Write an index file. |
Function | write_index_dict | Write an index file based on the contents of a dictionary. |
Function | cleanup_mode | Cleanup a mode value. |
Class | Index | A Git Index file. |
Function | commit_tree | Commit a new tree. |
Function | commit_index | Create a new tree from an index. |
Function | changes_from_tree | Find the differences between the contents of a tree and a working copy. |
Function | index_entry_from_stat | Create a new index entry from a stat value. |
Function | build_file_from_blob | Build a file or symlink on disk based on a Git object. |
Function | validate_path_element_default | Undocumented |
Function | validate_path_element_ntfs | Undocumented |
Function | validate_path | Default path validator that just checks for .git/. |
Function | build_index_from_tree | Generate and materialize index from a tree |
Function | blob_from_path_and_stat | Create a blob from a path and a stat object. |
Function | read_submodule_head | Read the head commit of a submodule. |
Function | get_unstaged_changes | Walk through an index and check for differences against working tree. |
Function | index_entry_from_path | Create an index from a filesystem path. |
Function | iter_fresh_entries | Iterate over current versions of index entries on disk. |
Function | iter_fresh_blobs | Iterate over versions of blobs on disk referenced by index. |
Function | iter_fresh_objects | Iterate over versions of objecs on disk referenced by index. |
Function | refresh_index | Refresh the contents of an index. |
Function | _tree_to_fs_path | Convert a git tree path to a file system path. |
Function | _fs_to_tree_path | Convert a file system path to a git tree path. |
Parameters | path | The path to split. |
Returns | Tuple with directory name and basename |
Parameters | f | File-like object to read from |
Returns | Tuple with seconds and nanoseconds |
Parameters | f | File-like object to write to |
t | Time to write (as int, float or tuple with secs and nsecs) |
Parameters | f | File-like object to read from |
Returns | tuple with: device, inode, mode, uid, gid, size, sha, flags |
Parameters | f | File object |
entry | Entry to write, tuple with: (name, ctime, mtime, dev, ino, mode, uid, gid, size, sha, flags) |
Parameters | f | File object to read from |
Parameters | f | File-like object to write to |
entries | Iterable over the entries to write |
Cleanup a mode value.
This will return a mode that can be stored in a tree object.
Parameters | mode | Mode to clean up. |
Parameters | object_store | Object store to add trees to |
blobs | Iterable over blob path, sha, mode entries | |
Returns | SHA1 of the created tree. |
Parameters | object_store | Object store to save the tree in |
index | Index file | |
Returns | Root tree sha. | |
Note | This function is deprecated, use index.commit() instead. |
Parameters | names | Iterable of names in the working copy |
lookup_entry | Function to lookup an entry in the working copy | |
object_store | Object store to use for retrieving tree contents | |
tree | SHA1 of the root tree, or None for an empty tree | |
want_unchanged | Whether unchanged files should be reported | |
Returns | Iterator over tuples with (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) |
Parameters | stat_val | POSIX stat_result instance |
hex_sha | Hex sha of the object | |
flags | Index flags |
Parameters | obj | The git object |
mode | File mode | |
target_path | Path to write to | |
honor_filemode | An optional flag to honor core.filemode setting in config file, default is core.filemode=True, change executable bit | |
Returns | stat object for the file |
Generate and materialize index from a tree
Parameters | tree_id | Tree to materialize |
root_path | Target dir for materialized index files | |
index_path | Target path for generated index | |
object_store | Non-empty object store holding tree contents | |
honor_filemode | An optional flag to honor core.filemode setting in config file, default is core.filemode=True, change executable bit | |
validate_path_element | Function to validate path elements to check out; default just refuses .git and .. directories. |
Parameters | fs_path | Full file system path to file |
st | A stat object | |
Returns | A Blob object |
Parameters | path | path to the submodule |
Returns | HEAD sha, None if not a valid head/repository |
Parameters | index | index to check |
root_path | path in which to find files | |
Returns | iterator over paths with unstaged changes |
Parameters | root_path | Root filesystem path |
tree_path | Git tree path as bytes | |
Returns | File system path. |
Parameters | fs_path | File system path. |
fs_encoding | File system encoding | |
Returns | Git tree path as bytes |
Create an index from a filesystem path.
This returns an index value for files, symlinks and tree references. for directories and non-existant files it returns None
Parameters | path | Path to create an index entry for |
object_store | Optional object store to save new blobs in | |
Returns | An index entry |
Parameters | paths | Paths to iterate over |
root_path | Root path to access from | |
store | Optional store to save new blobs in | |
Returns | Iterator over path, index_entry |
Iterate over versions of blobs on disk referenced by index.
Don't use this function; it removes missing entries from index.
Parameters | index | Index file |
root_path | Root path to access from | |
include_deleted | Include deleted entries with sha and mode set to None | |
Returns | Iterator over path, sha, mode |
Parameters | index | Index file |
root_path | Root path to access from | |
include_deleted | Include deleted entries with sha and mode set to None | |
object_store | Optional object store to report new items to | |
Returns | Iterator over path, sha, mode |