Simple command-line interface to Dulwich>.
This is a very simple command-line wrapper for Dulwich. It is by no means intended to be a full-blown Git command-line interface but just a way to test Dulwich.
| Class | |
Wrapper that automatically flushes a BinaryIO stream based on configuration. |
| Class | |
Wrapper that automatically flushes a TextIO stream based on configuration. |
| Class | cmd |
Add file contents to the index. |
| Class | cmd |
Apply patches from mailbox-style email messages. |
| Class | cmd |
Annotate each line in a file with commit information. |
| Class | cmd |
Apply a patch to files and/or to the index. |
| Class | cmd |
Create an archive of files from a named tree. |
| Class | cmd |
Use binary search to find the commit that introduced a bug. |
| Class | cmd |
Show what revision and author last modified each line of a file. |
| Class | cmd |
List, create, or delete branches. |
| Class | cmd |
Create, unpack, and manipulate bundle files. |
| Class | cmd |
Provide content or type and size information for repository objects. |
| Class | cmd |
Check whether files are excluded by gitignore. |
| Class | cmd |
Show canonical names and email addresses of contacts. |
| Class | cmd |
Switch branches or restore working tree files. |
| Class | cmd |
Find commits not merged upstream. |
| Class | cmd |
Apply the changes introduced by some existing commits. |
| Class | cmd |
Remove untracked files from the working tree. |
| Class | cmd |
Clone a repository into a new directory. |
| Class | cmd |
Display data in columns. |
| Class | cmd |
Record changes to the repository. |
| Class | cmd |
Create a new commit object from a tree. |
| Class | cmd |
Get and set repository or global options. |
| Class | cmd |
Count unpacked number of objects and their disk consumption. |
| Class | cmd |
Run a simple Git protocol server. |
| Class | cmd |
Give an object a human readable name based on an available ref. |
| Class | cmd |
Display diagnostic information about the Python environment. |
| Class | cmd |
Show changes between commits, commit and working tree, etc. |
| Class | cmd |
Compare the content and mode of trees. |
| Class | cmd |
Show information about a pack index file. |
| Class | cmd |
Dump the contents of a pack file for debugging. |
| Class | cmd |
Download objects and refs from another repository. |
| Class | cmd |
Receive missing objects from another repository. |
| Class | cmd |
Rewrite branches. |
| Class | cmd |
Output information on each ref. |
| Class | cmd |
Prepare patches for e-mail submission. |
| Class | cmd |
Verify the connectivity and validity of objects in the database. |
| Class | cmd |
Cleanup unnecessary files and optimize the local repository. |
| Class | cmd |
Search for patterns in tracked files. |
| Class | cmd |
Compute object ID and optionally store in repository. |
| Class | cmd |
Display help information about git. |
| Class | cmd |
Create an empty Git repository or reinitialize an existing one. |
| Class | cmd |
Add or parse structured information in commit messages. |
| Class | cmd |
Git Large File Storage management. |
| Class | cmd |
Show commit logs. |
| Class | cmd |
Show information about files in the index and working tree. |
| Class | cmd |
List references in a remote repository. |
| Class | cmd |
List the contents of a tree object. |
| Class | cmd |
Extract patch information from an email message. |
| Class | cmd |
Split mbox or Maildir into individual message files. |
| Class | cmd |
Run tasks to optimize Git repository data. |
| Class | cmd |
Join two or more development histories together. |
| Class | cmd |
Find the best common ancestor between commits. |
| Class | cmd |
Show three-way merge without touching index. |
| Class | cmd |
Create a tag object from raw tag data. |
| Class | cmd |
Move or rename a file, a directory, or a symlink. |
| Class | cmd |
Add or inspect object notes. |
| Class | cmd |
Add notes to a commit. |
| Class | cmd |
List all note objects. |
| Class | cmd |
Remove notes for a commit. |
| Class | cmd |
Show notes for a commit. |
| Class | cmd |
Create a packed archive of objects. |
| Class | cmd |
Pack heads and tags for efficient repository access. |
| Class | cmd |
Prune all unreachable objects from the object database. |
| Class | cmd |
Fetch from and integrate with another repository or a local branch. |
| Class | cmd |
Update remote refs along with associated objects. |
| Class | cmd |
Reapply commits on top of another base tip. |
| Class | cmd |
Receive what is pushed into the repository. |
| Class | cmd |
Manage reflog information. |
| Class | cmd |
Manage set of tracked repositories. |
| Class | cmd |
Add a remote repository. |
| Class | cmd |
Pack unpacked objects in a repository. |
| Class | cmd |
Create, list, and delete replacement refs. |
| Class | cmd |
Delete a replacement ref. |
| Class | cmd |
List all replacement refs. |
| Class | cmd |
Record and reuse recorded conflict resolutions. |
| Class | cmd |
Reset current HEAD to the specified state. |
| Class | cmd |
Restore working tree files. |
| Class | cmd |
List commit objects in reverse chronological order. |
| Class | cmd |
Parse revision and other objects. |
| Class | cmd |
Revert some existing commits. |
| Class | cmd |
Remove files from the working tree and from the index. |
| Class | cmd |
Show a shortlog of commits by author. |
| Class | cmd |
Show various types of objects. |
| Class | cmd |
Show branches and their commits. |
| Class | cmd |
Show packed archive index. |
| Class | cmd |
List references in a local repository. |
| Class | cmd |
Manage sparse checkout. |
| Class | cmd |
Add directories to sparse checkout. |
| Class | cmd |
Disable sparse checkout. |
| Class | cmd |
Initialize sparse checkout in cone mode. |
| Class | cmd |
List sparse checkout patterns. |
| Class | cmd |
Set sparse checkout directories. |
| Class | cmd |
Stash the changes in a dirty working directory away. |
| Class | cmd |
List stash entries. |
| Class | cmd |
Apply a stash and remove it from the stash list. |
| Class | cmd |
Save your local modifications to a new stash. |
| Class | cmd |
Show the working tree status. |
| Class | cmd |
Remove unnecessary whitespace from text. |
| Class | cmd |
Initialize, update or inspect submodules. |
| Class | cmd |
Add a submodule. |
| Class | cmd |
Initialize submodules. |
| Class | cmd |
List submodules. |
| Class | cmd |
Update submodules. |
| Class | cmd |
Manage subtrees within a repository. |
| Class | cmd |
Add a subtree. |
| Class | cmd |
Merge changes into a subtree. |
| Class | cmd |
Pull changes from a remote repository into a subtree. |
| Class | cmd |
Push a subtree to a remote repository. |
| Class | cmd |
Split a subtree into a separate branch. |
| Class | cmd |
Switch branches. |
| Class | cmd |
Read, modify and delete symbolic refs. |
| Class | cmd |
Create, list, delete or verify a tag object. |
| Class | cmd |
Unpack objects from a packed archive. |
| Class | cmd |
Update the object name stored in a ref safely. |
| Class | cmd |
Update auxiliary info file to help dumb servers. |
| Class | cmd |
Send objects packed back to git-fetch-pack. |
| Class | cmd |
Display Git logical variables. |
| Class | cmd |
Check the GPG signature of commits. |
| Class | cmd |
Check the GPG signature of tags. |
| Class | cmd |
Run a simple HTTP server for Git repositories. |
| Class | cmd |
Manage multiple working trees. |
| Class | cmd |
Create a new worktree. |
| Class | cmd |
List worktrees. |
| Class | cmd |
Lock a worktree to prevent it from being pruned. |
| Class | cmd |
Move a worktree to a new location. |
| Class | cmd |
Prune worktree information. |
| Class | cmd |
Remove a worktree. |
| Class | cmd |
Repair worktree administrative files. |
| Class | cmd |
Unlock a locked worktree. |
| Class | cmd |
Create a tree object from the current index. |
| Class | |
A Dulwich subcommand. |
| Class | |
File-like object that pages output through external pager programs. |
| Class | |
Binary buffer wrapper for Pager to mimic sys.stdout.buffer. |
| Class | |
Base class for commands that have subcommands. |
| Exception | |
Raised when there's an issue with the commit message. |
| Function | detect |
Detect the width of the terminal. |
| Function | disable |
Disable pager for this session. |
| Function | enable |
Enable pager for this session. |
| Function | format |
Format bytes as human-readable string. |
| Function | format |
Format items into columns with various layout modes. |
| Function | get |
Get a pager instance if paging should be used, otherwise return sys.stdout. |
| Function | launch |
Launch an editor for the user to enter text. |
| Function | main |
Main entry point for the Dulwich CLI. |
| Function | parse |
Parse a time specification and return a Unix timestamp. |
| Function | signal |
Handle interrupt signal by exiting. |
| Function | signal |
Handle quit signal by entering debugger. |
| Function | to |
Convert a bytes or string value to a display string. |
| Function | write |
Display items in formatted columns based on terminal width. |
| Variable | commands |
Undocumented |
| Variable | logger |
Undocumented |
| Class | _ |
Adapter to make streams work with context manager protocol. |
| Function | _get |
Get commit message with an initial message template. |
| Function | _main |
Undocumented |
| Function | _protocol |
Parse the version from the GIT_PROTOCOL environment variable. |
| Function | _should |
Determine if output should be auto-flushed based on GIT_FLUSH environment variable. |
| Function | _ssh |
Return the ssh command requested via GIT_SSH_COMMAND / GIT_SSH. |
Detect the width of the terminal.
| Returns | |
int | Width of the terminal in characters, or 80 if it cannot be determined |
list[ str], width: int | None = None, mode: str = 'column', padding: int = 1, indent: str = '', nl: str = '\n') -> str:
¶
Format items into columns with various layout modes.
Examples
>>> format_columns(["a", "b", "c"], width=20, mode="column") "a b\\nc\\n" >>> format_columns(["a", "b", "c"], width=20, mode="row") "a b c\\n"
| Parameters | |
items:list[ | List of strings to format |
width:int | None | Terminal width (auto-detected if None) |
mode:str | Layout mode - "column" (fill columns first), "row" (fill rows first), "plain" (one column), or add ",dense" for unequal column widths |
padding:int | Number of spaces between columns |
indent:str | String to prepend to each line |
nl:str | String to append to each line (including newline) |
| Returns | |
str | Formatted string with items in columns |
Config | None = None, cmd_name: str | None = None) -> _StreamContextAdapter | Pager:
¶
Get a pager instance if paging should be used, otherwise return sys.stdout.
| Parameters | |
config:Config | None | Optional config instance (e.g., StackedConfig) to read settings from |
cmdstr | None | Optional command name for per-command pager settings |
| Returns | |
_StreamContextAdapter | Pager | Either a wrapped sys.stdout or a Pager instance (both context managers) |
Parse a time specification and return a Unix timestamp.
| Parameters | |
timestr | Time specification. Can be: - A Unix timestamp (integer as string) - A relative time like "2 weeks ago" - "now" for current time - "all" to expire all entries (returns future time) - "never" to never expire (returns 0 - epoch start) |
| Returns | |
int | Unix timestamp |
| Raises | |
ValueError | If the time specification cannot be parsed |
Handle interrupt signal by exiting.
| Parameters | |
signal:int | Signal number |
frame:types.FrameType | None | Current stack frame |
Handle quit signal by entering debugger.
| Parameters | |
signal:int | Signal number |
frame:types.FrameType | None | Current stack frame |
Iterator[ bytes] | Sequence[ bytes], out: TextIO, width: int | None = None):
¶
Display items in formatted columns based on terminal width.
The function calculates the optimal number of columns to fit the terminal width and displays the items in a formatted column layout with proper padding and alignment.
| Parameters | |
items:Iterator[ | List or iterator of bytes objects to display in columns |
out:TextIO | Output stream to write to |
width:int | None | Optional width of the terminal (if None, auto-detect) |
bytes | None, repo: Repo | None = None, commit: Commit | None = None) -> bytes:
¶
Get commit message with an initial message template.
Parse the version from the GIT_PROTOCOL environment variable.
Git uses a colon-separated key=value format for GIT_PROTOCOL (for example version=2 or feature=extra:version=2). Return the requested version as an int when present and parseable, otherwise None.
Env lookup lives here in the CLI layer rather than in the transport
library so that dulwich.client and dulwich.porcelain
remain process-environment-free.
Return the ssh command requested via GIT_SSH_COMMAND / GIT_SSH.
GIT_SSH_COMMAND wins over GIT_SSH, matching git's own precedence. Returns None when neither is set, so callers can fall through to the core.sshCommand config or the transport default.
Env lookup lives here in the CLI layer rather than in the transport
library so that dulwich.client stays process-environment-free.