Expand description
VCS-specific helpers built on procpilot. Adds jj/git shorthand
wrappers, repo detection, and output parsers.
For generic subprocess execution (stdin, retry, timeout, custom envs),
use procpilot::Cmd directly — it’s re-exported here for convenience.
Modules§
- prelude
- Common types and helpers for everyday VCS subprocess work.
Structs§
- Bookmark
- A jj bookmark with sync status.
- Bookmark
Parse Result - Result of parsing bookmark output, including any skipped entries.
- Cmd
- Builder for a subprocess invocation or pipeline.
- CmdDisplay
- Owned snapshot of a command’s program + args, formatted shell-style on
Display. For pipelines, renders each stage separated by|. - Default
Runner - Default
Runnerthat delegates toCmd::run. - File
Change - A single file change in a diff summary.
- GitRemote
- A git remote.
- JjOperation
- A single entry in the jj operation log.
- LogEntry
- A jj log entry parsed from jj template JSON output.
- LogParse
Result - Result of parsing log output, including any skipped entries.
- Retry
Policy - How retries are scheduled and which errors trigger them.
- RunOutput
- Captured output from a successful command.
- Spawned
Process - Handle to one or more spawned subprocesses (a single command or a pipeline).
Enums§
- Conflict
State - Whether a jj commit has unresolved conflicts.
- Content
State - Whether a jj commit is empty (no file changes).
- File
Change Kind - The kind of change a file underwent in a diff.
- Redirection
- Where a child process’s stdout or stderr goes.
- Remote
Status - Sync status of a bookmark relative to its remote.
- RunError
- Error type for subprocess execution.
- Stdin
Data - Input data to feed to a child process’s stdin.
- VcsBackend
- Which version control system is managing a directory.
- Working
Copy - Whether a jj commit is the current working copy.
Constants§
- BOOKMARK_
TEMPLATE - jj template for
jj bookmark listproducing line-delimited JSON. - LOG_
TEMPLATE - jj template for
jj logproducing line-delimited JSON entries. - STREAM_
SUFFIX_ SIZE - Maximum bytes of stdout/stderr retained on
NonZeroExit,Timeout, andCancellederror variants. Anything beyond this is dropped from the front (FIFO), keeping the most recent output — usually the most relevant for debugging.
Traits§
Functions§
- binary_
available - Check whether a binary is available on PATH.
- binary_
version - Return a binary’s
--versionoutput, if available. - default_
transient - Default transient-error predicate.
- detect_
vcs - Detect the VCS backend for a path, without running any subprocesses.
- git_
available - Check whether the
gitbinary is available on PATH. - git_
merge_ base - Find the merge base of two revisions in a git repository.
- git_
version - Get the git version string, if available.
- is_
transient_ error - Default transient-error check for jj/git.
- jj_
available - Check whether the
jjbinary is available on PATH. - jj_
current_ operation_ id - The id of the current (head) operation in the operation log.
- jj_
divergent_ change_ ids - Change ids that are divergent (one change id on multiple visible commits) — the persistent tell left by a concurrent op-log reconcile. Deduplicated: a change divergent across N commits is reported once. Empty means clean.
- jj_
is_ divergent_ at_ operation - Whether divergent changes exist as of a specific past operation. Lets a
caller walk back to the most recent operation whose state predates a
divergence, to
jj_op_restoreto. - jj_
merge_ base - Find the merge base of two revisions in a jj repository.
- jj_
op_ restore - Roll the repo back to
op_id(jj op restore). The recovery primitive: pick a known-good operation instead of keeping jj’s mangled auto-merge. - jj_
operation_ log - The recent operation-log entries, newest first, up to
limit(0= all). - jj_
revset_ at_ operation - The commit ids
revsetresolves to as of a specific operation —<ws>@at op X,mainat op X, or any revset. The building block for reconstructing a ref’s history from the operation log without parsingop log --op-diffprose (jj exposes no structured op-diff, so text-scraping is the alternative, and it is exactly the “op log is a safety net, not a tool” anti-pattern). - jj_
revset_ history - The distinct commit ids
revsetresolved to across the operation log, newest first — jj’s analog ofgit reflog <ref>, for any revset. The first-class replacement for scrapingop log --op-diffto answer “what did this ever point at” (working-copy recovery, pre-rebase-head recovery, drift detection). - jj_
version - Get the jj version string, if available.
- parse_
bookmark_ output - Parse
jj bookmark list --template BOOKMARK_TEMPLATEoutput. - parse_
diff_ summary - Parse
jj diff --summaryoutput into structuredFileChangevalues. - parse_
git_ diff_ name_ status - Parse
git diff --name-statusoutput into structuredFileChangevalues. - parse_
log_ output - Parse
jj log --template LOG_TEMPLATEoutput. - parse_
remote_ list - Parse
jj git remote listoutput intoGitRemotevalues. - read_
working_ file - Read a working-tree file’s current on-disk content as text (lossy UTF-8).
Ok(None)when the file is absent (e.g. deleted);Erronly on a real I/O error. - read_
working_ file_ bytes - Bytes variant of
read_working_file, for image/binary handling. - run_git
- Run a
gitcommand in a repo directory, returning captured output. - run_
git_ cancellable - Run a
gitcommand with caller-driven cancellation. Seerun_jj_cancellablefor semantics. - run_
git_ utf8 - Run a
gitcommand, returning lossy-decoded, trimmed stdout as aString. - run_
git_ utf8_ cancellable - Run a
gitcommand with cancellation, returning trimmed stdout as aString. - run_
git_ utf8_ with_ retry - Run a
gitcommand with retry, returning trimmed stdout as aString. - run_
git_ utf8_ with_ retry_ cancellable - Run a
gitcommand with retry + cancellation, returning trimmed stdout as aString. - run_
git_ utf8_ with_ timeout - Run a
gitcommand with a timeout, returning trimmed stdout as aString. - run_
git_ with_ retry - Run a
gitcommand with retry on transient errors. - run_
git_ with_ retry_ cancellable - Run a
gitcommand with retry on transient errors plus caller-driven cancellation. Seerun_jj_with_retry_cancellablefor semantics. - run_
git_ with_ timeout - Run a
gitcommand with a timeout. - run_jj
- Run a
jjcommand in a repo directory, returning captured output. - run_
jj_ cancellable - Run a
jjcommand with caller-driven cancellation. - run_
jj_ utf8 - Run a
jjcommand, returning lossy-decoded, trimmed stdout as aString. - run_
jj_ utf8_ cancellable - Run a
jjcommand with cancellation, returning trimmed stdout as aString. - run_
jj_ utf8_ ignore_ wc - Run a
jjcommand working-copy-agnostically — with--ignore-working-copyprepended — returning lossy-decoded, trimmed stdout. - run_
jj_ utf8_ with_ retry - Run a
jjcommand with retry, returning trimmed stdout as aString. - run_
jj_ utf8_ with_ retry_ cancellable - Run a
jjcommand with retry + cancellation, returning trimmed stdout as aString. - run_
jj_ utf8_ with_ timeout - Run a
jjcommand with a timeout, returning trimmed stdout as aString. - run_
jj_ with_ retry - Run a
jjcommand with retry on transient errors. - run_
jj_ with_ retry_ cancellable - Run a
jjcommand with retry on transient errors plus caller-driven cancellation. - run_
jj_ with_ timeout - Run a
jjcommand with a timeout. - working_
file_ is_ binary - Whether a working-tree file looks binary — a NUL byte in the first 8 KiB
(git’s heuristic). Reads only that prefix, so a large binary isn’t slurped in
full just to be classified. Absent or unreadable ⇒
false.