Skip to main content

Crate onevcs

Crate onevcs 

Source
Expand description

Version control and its remote host behind one host-neutral vocabulary.

The review unit is a ChangeRequest — GitHub maps it to a pull request, and a later host maps it to whatever it calls the same thing. Vcs owns the repository side (identities, sessions, preserved work) and RemoteHost owns the host side (opening a change, reading its checks, merging it). A rules file decides, per repository, how a change is published and what verifies it. Everything a process does along the way is emitted as an Envelope.

§The shape of one change

session open  →  a per-run --shared clone and one worktree, occupancy-leased
   →  work happens in the worktree
   →  publish   →  fetch and merge the current base  (bounded resolve-and-requeue)
                →  the gate: a command, the pre-push hook, or the host's checks
                →  local-direct squash, or a change request the host lands
   →  session close  →  the worktree goes; the branch is copied out and stays

Everything durable lives under one state root (ONEVCS_HOME, otherwise ~/.onevcs): the registry document, the advisory locks and merge-queue state, the per-session workspaces, the event streams, and their artifacts.

§Two surfaces over one decision

run is the command line: it answers a process, with an exit code and a line of prose. A caller embedding this crate wants the decision itself, so the same operations answer values — publish hands back a Publication, close_session the session it released, session what the repository side recorded, and EventStream the envelopes one session wrote. The command line is a rendering of those rather than a second path through them.

Re-exports§

pub use registry::Identity;
pub use rules::MergePolicy;

Modules§

cli
The command-line argument surface.
registry
The registry document: which repository identities exist, which checkouts belong to each, and where the rules file lives.
rules
The rules file: how each repository publishes a change, and what verifies it.

Structs§

ArtifactId
The id of a stored artifact.
ArtifactRef
A reference to evidence stored beside the stream rather than inside it.
ChangeChecks
What a host reports about a change request’s checks, and where it looked.
ChangeId
A host’s identifier for a change request.
ChangeRequest
An open change request on the host.
ChangeSpec
What to open a change request for.
Check
One check the host reports on a change request.
Envelope
One event, as a producing process writes it to its NDJSON stream.
EventStream
A reader over one session’s event stream, as values rather than as text.
Git
The git implementation of Vcs.
GitHub
The GitHub implementation of RemoteHost, driven through gh.
Labels
What a producer knew about the run when it stamped an event.
PreservedBranch
A branch that holds work outside its session.
Providers
The repository side and the remote-host side of one run.
Publication
What one publication did.
PublishRequest
What one publication was asked for beyond the session it publishes.
Recoverable
Preserved work that has not been published, and what would land it.
Session
An open session: a per-run shared clone plus a worktree, held under an occupancy lease.
SessionRecord
Everything the implementation that opened a session records about it.
SessionRequest
What to open a session over.
SessionToken
The handle a session is adopted, published, and closed by.
Sha
A commit hash.
Subject
A title that can be the subject of the commit a publication lands.
Url
A parsed absolute URL, re-exported so a caller needs no direct dependency on the parser this crate validates change-request URLs with. A parsed URL record.

Enums§

CheckSource
One place a host’s answer about a change request’s checks was read from.
Error
Everything an onevcs operation can fail with.
EventKind
What an event says happened.
FailureKind
Which failure ended a publication, and therefore which exit code says so.
Lifecycle
Where a session is in its life.
MergeOutcome
What merging a change request did.
Provenance
Why a branch was preserved, and therefore what recovering it must do.
PublishOutcome
How a publication ended.
Retention
What became of a branch whose publication did not land.
Scope
Which preserved work to look for.
Source
The library that produced an event.

Traits§

Hosting
Where a RemoteHost for one repository comes from.
RemoteHost
Everything onevcs asks of a repository’s remote host.
Vcs
Everything onevcs does to a repository, independent of which version control system is underneath.

Functions§

close_session
Release a session’s worktree and its occupancy lease, keeping its branch.
publish
Verify a session’s work and publish it, returning what the publication did.
run
Run one parsed command line, returning the process exit code.
run_with
Run one parsed command line against supplied implementations of the two interfaces, returning the process exit code.
session
What the repository side recorded about a session.

Type Aliases§

Result
The result type every fallible entry point in this crate returns.