dulwich.porcelain
module documentationdulwich
Simple wrapper that provides porcelain-like functions on top of Dulwich.
These functions are meant to behave similarly to the git subcommands. Differences in behaviour are considered bugs.
Functions should generally accept both unicode strings and bytestrings
Class | NoneStream | Fallback if stdout or stderr are unavailable, does nothing. |
Class | RemoteExists | Raised when the remote already exists. |
Function | open_repo | Open an argument that can be a repository or a path for a repository. |
Function | open_repo_closing | Open an argument that can be a repository or a path for a repository. returns a context manager that will close the repo on exit if the argument is a path, else does nothing if the argument is a repo. |
Function | path_to_tree_path | Convert a path to a path usable in an index, e.g. bytes and relative to the repository root. |
Function | archive | Create an archive. |
Function | update_server_info | Update server info files for a repository. |
Function | symbolic_ref | Set git symbolic ref into HEAD. |
Function | commit | Create a new commit. |
Function | commit_tree | Create a new commit object. |
Function | init | Create a new git repository. |
Function | clone | Clone a local or remote git repository. |
Function | add | Add files to the staging area. |
Function | remove | Remove files from the staging area. |
Function | commit_decode | Undocumented |
Function | print_commit | Write a human-readable commit log entry. |
Function | print_tag | Write a human-readable tag. |
Function | show_blob | Write a blob to a stream. |
Function | show_commit | Show a commit to a stream. |
Function | show_tree | Print a tree to a stream. |
Function | show_tag | Print a tag to a stream. |
Function | show_object | Undocumented |
Function | print_name_status | Print a simple status summary, listing changed files. |
Function | log | Write commit logs. |
Function | show | Print the changes in a commit. |
Function | diff_tree | Compares the content and mode of blobs found via two tree objects. |
Function | rev_list | Lists commit objects in reverse chronological order. |
Function | tag | Undocumented |
Function | tag_create | Creates a tag in git via dulwich calls: |
Function | list_tags | Undocumented |
Function | tag_list | List all tags. |
Function | tag_delete | Remove a tag. |
Function | reset | Reset current HEAD to the specified state. |
Function | push | Remote push with dulwich via dulwich.client |
Function | pull | Pull from remote via dulwich.client |
Function | status | Returns staged, unstaged, and untracked changes relative to the HEAD. |
Function | get_untracked_paths | Get untracked paths. |
Function | get_tree_changes | Return add/delete/modify changes to tree by comparing index to HEAD. |
Function | daemon | Run a daemon serving Git requests over TCP/IP. |
Function | web_daemon | Run a daemon serving Git requests over HTTP. |
Function | upload_pack | Upload a pack file after negotiating its contents using smart protocol. |
Function | receive_pack | Receive a pack file after negotiating its contents using smart protocol. |
Function | branch_delete | Delete a branch. |
Function | branch_create | Create a branch. |
Function | branch_list | List all branches. |
Function | fetch | Fetch objects from a remote server. |
Function | ls_remote | List the refs in a remote. |
Function | repack | Repack loose files in a repository. |
Function | pack_objects | Pack objects into a file. |
Function | ls_tree | List contents of a tree. |
Function | remote_add | Add a remote. |
Function | check_ignore | Debug gitignore files. |
Function | update_head | Update HEAD to point at a new branch/commit. |
Function | check_mailmap | Check canonical name and email of contact. |
Function | fsck | Check a repository. |
Function | stash_list | List all stashes in a repository. |
Function | stash_push | Push a new stash onto the stack. |
Function | stash_pop | Pop a new stash from the stack. |
Function | ls_files | List all files in an index. |
Function | describe | Describe the repository version. |
Function | get_object_by_path | Get an object by path. |
Function | _noop_context_manager | Context manager that has the same api as closing but does nothing. |
Function | _make_branch_ref | Undocumented |
Function | _make_tag_ref | Undocumented |
Parameters | repopath | Repository path, absolute or relative to the cwd |
path | A path, absolute or relative to the cwd | |
Returns | A path formatted for use in e.g. an index |
Parameters | repo | Path of repository for which to generate an archive. |
committish | Commit SHA1 or ref to use | |
outstream | Output stream (defaults to stdout) | |
errstream | Error stream (defaults to stderr) |
Parameters | repo | path to the repository |
Parameters | repo | path to the repository |
ref_name | short name of the new ref | |
force | force settings without checking if it exists in refs/heads |
Parameters | repo | Path to repository |
message | Optional commit message | |
author | Optional author name and email | |
committer | Optional committer name and email | |
Returns | SHA1 of the new commit |
Parameters | repo | Path to repository |
tree | An existing tree object | |
author | Optional author name and email | |
committer | Optional committer name and email |
Parameters | path | Path to repository. |
bare | Whether to create a bare repository. | |
Returns | A Repo instance |
Parameters | source | Path or URL for source repository |
target | Path to target repository (optional) | |
bare | Whether or not to create a bare repository | |
checkout | Whether or not to check-out HEAD after cloning | |
errstream | Optional stream to write progress to | |
outstream | Optional stream to write progress to (deprecated) | |
origin | Name of remote from the repository used to clone | |
depth | Depth to fetch at | |
Returns | The new repository |
Parameters | repo | Repository for the files |
paths | Paths to add. No value passed stages all modified files. | |
Returns | Tuple with set of added files and ignored files |
Parameters | repo | Repository for the files |
paths | Paths to remove |
Parameters | commit | A Commit object |
outstream | A stream file to write to |
Parameters | tag | A Tag object |
decode | Function for decoding bytes to unicode string | |
outstream | A stream to write to |
Parameters | repo | Path to repository |
paths | Optional set of specific paths to print entries for | |
outstream | Stream to write log output to | |
reverse | Reverse order in which entries are printed | |
name_status | Print name status | |
max_entries | Optional maximum number of entries to display |
Parameters | repo | Path to repository |
objects | Objects to show (defaults to [HEAD]) | |
outstream | Stream to write to | |
default_encoding | Default encoding to use if none is set in the commit |
Parameters | repo | Path to repository |
old_tree | Id of old tree | |
new_tree | Id of new tree | |
outstream | Stream to write to |
Parameters | repo | Path to repository |
commits | Commits over which to iterate | |
outstream | Stream to write to |
Parameters | repo | Path to repository |
tag | tag string | |
author | tag author (optional, if annotated is set) | |
message | tag message (optional) | |
annotated | whether to create an annotated tag | |
objectish | object the tag should point at, defaults to HEAD | |
tag_time | Optional time for annotated tag | |
tag_timezone | Optional timezone for annotated tag |
Parameters | repo | Path to repository |
outstream | Stream to write tags to |
Parameters | repo | Path to repository |
mode | Mode ("hard", "soft", "mixed") | |
treeish | Treeish to reset to |
Parameters | repo | Path to repository |
remote_location | Location of the remote | |
refspecs | Refs to push to remote | |
outstream | A stream file to write output | |
errstream | A stream file to write errors |
Parameters | repo | Path to repository |
remote_location | Location of the remote | |
refspec | refspecs to fetch | |
outstream | A stream file to write to output | |
errstream | A stream file to write to errors |
Parameters | repo | Path to repository or repository object |
ignored | Whether to include ignored files in untracked | |
Returns | GitStatus tuple, staged - list of staged paths (diff index/HEAD) unstaged - list of unstaged paths (diff index/working-tree) untracked - list of untracked, un-ignored & non-.git paths |
Get untracked paths.
;param frompath: Path to walk :param basepath: Path to compare to :param index: Index to check against
Parameters | repo | repo path or object |
Returns | dict with lists for each type of change |
Parameters | path | Path to the directory to serve. |
address | Optional address to listen on (defaults to ::) | |
port | Optional port to listen on (defaults to TCP_GIT_PORT) |
Parameters | path | Path to the directory to serve |
address | Optional address to listen on (defaults to ::) | |
port | Optional port to listen on (defaults to 80) |
Parameters | path | Path to the repository |
inf | Input stream to communicate with client | |
outf | Output stream to communicate with client |
Parameters | path | Path to the repository |
inf | Input stream to communicate with client | |
outf | Output stream to communicate with client |
Parameters | repo | Path to the repository |
name | Name of the branch |
Parameters | repo | Path to the repository |
name | Name of the new branch | |
objectish | Target object to point new branch at (defaults to HEAD) | |
force | Force creation of branch, even if it already exists |
Parameters | repo | Path to the repository |
remote_location | String identifying a remote server | |
remote_name | Name for remote server | |
outstream | Output stream (defaults to stdout) | |
errstream | Error stream (defaults to stderr) | |
message | Reflog message (defaults to b"fetch: from <remote_name>") | |
depth | Depth to fetch at | |
Returns | Dictionary with refs on the remote |
Parameters | remote | Remote repository location |
config | Configuration to use | |
Returns | Dictionary with remote refs |
Repack loose files in a repository.
Currently this only packs loose objects.
Parameters | repo | Path to the repository |
Parameters | repo | Path to the repository |
object_ids | List of object ids to write | |
packf | File-like object to write to | |
idxf | File-like object to write to (can be None) |
Parameters | repo | Path to the repository |
tree_ish | Tree id to list | |
outstream | Output stream (defaults to stdout) | |
recursive | Whether to recursively list files | |
name_only | Only print item name |
Parameters | repo | Path to the repository |
name | Remote name | |
url | Remote URL |
Parameters | repo | Path to the repository |
paths | List of paths to check for | |
no_index | Don't check index | |
Returns | List of ignored files |
Update HEAD to point at a new branch/commit.
Note that this does not actually update the working tree.
Parameters | repo | Path to the repository |
detach | Create a detached head | |
target | Branch or committish to switch to | |
new_branch | New branch to create |
Parameters | repo | Path to the repository |
contact | Contact name and/or email | |
Returns | Canonical contact data |
Parameters | repo | A path to the repository |
Returns | Iterator over errors/warnings |
Describe the repository version.
Examples: "gabcdefh", "v0.1" or "v0.1-5-gabcdefh".
Parameters | projdir | git repository root |
Returns | a string description of the current git revision |
Parameters | repo | A path to the repository |
path | Path to look up | |
committish | Commit to look up path in | |
Returns | A ShaFile object |