Crate svn

Crate svn 

Source
Expand description

Async client for Subversion’s svn:// (ra_svn) protocol.

This crate implements a subset of Subversion’s remote access protocol used by svnserve (the svn:// scheme). It is a network client and does not implement a working copy.

Most users should start with RaSvnClient to create a connected RaSvnSession.

§Getting started

use std::time::Duration;
use svn::{RaSvnClient, SvnUrl};

fn main() -> svn::Result<()> {
    let rt = tokio::runtime::Builder::new_current_thread()
        .enable_all()
        .build()?;

    rt.block_on(async {
        let url = SvnUrl::parse("svn://example.com/repo")?;
        let client = RaSvnClient::new(url, None, None)
            .with_read_timeout(Duration::from_secs(30));

        // A session reuses one connection and caches server info.
        let mut session = client.open_session().await?;
        let latest = session.get_latest_rev().await?;
        println!("{latest}");
        Ok(())
    })
}

§Features

  • serde: enables Serialize/Deserialize for public data types.
  • cyrus-sasl: enables Cyrus SASL authentication and (when negotiated) the SASL security layer (requires a system-provided libsasl2 at runtime).
  • ssh: enables svn+ssh:// by running svnserve -t over SSH (via russh).

§Protocol notes

  • svn:// is supported.
  • svn+ssh:// is supported with the ssh feature (see SshConfig).
  • IPv6 URLs must use brackets (for example svn://[::1]/repo).
  • Built-in authentication mechanisms: ANONYMOUS, PLAIN, and CRAM-MD5. With cyrus-sasl, the client can also use Cyrus SASL (including the optional SASL security layer when negotiated).

§Custom transports

If you need to bring your own transport (for example a custom proxy/tunnel), you can connect the stream yourself and then call RaSvnClient::open_session_with_stream.

§Low-level access

For raw wire protocol items, see raw::SvnItem.

Modules§

raw
Low-level wire-protocol types and helpers.

Structs§

BlameLine
One annotated line as returned by crate::RaSvnSession::blame_file.
ChangedPath
A single path change entry within a LogEntry.
CommitBuilder
High-level commit editor builder.
CommitInfo
A successful commit result returned by crate::RaSvnSession::commit.
CommitLockToken
A path/token pair to include in crate::CommitOptions::lock_tokens.
CommitOptions
Options for crate::RaSvnSession::commit.
CommitStreamBuilder
High-level commit builder that streams file contents from an AsyncRead.
DiffOptions
Options for crate::RaSvnSession::diff.
DirEntry
A directory entry as returned by directory listing operations.
DirListing
Result of get-dir as returned by crate::RaSvnSession::list_dir.
FileRev
A file revision entry as returned by get-file-revs.
FileRevContents
A FileRev entry with materialized file contents.
FsEditor
Applies update/switch/replay-style editor drives to a filesystem directory.
GetFileOptions
Options for crate::RaSvnSession::get_file_with_options.
GetFileResult
Result metadata returned by crate::RaSvnSession::get_file_with_result.
InheritedProps
Inherited properties for a path.
ListOptions
Options for crate::RaSvnSession::list_with_options.
LocationEntry
A (revision, path) pair as returned by get-locations.
LocationSegment
A location segment as returned by get-location-segments.
LockDesc
A lock description as returned by get-lock(s) or lock.
LockManyOptions
Options for crate::RaSvnSession::lock_many.
LockOptions
Options for crate::RaSvnSession::lock.
LockTarget
A lock target for crate::RaSvnSession::lock_many.
LogEntry
A log entry returned by log.
LogOptions
Options for crate::RaSvnSession::log_with_options.
PooledSession
A checked-out session returned by SessionPool::session.
PropDelta
A single property delta entry (name + new value).
RaSvnClient
A reusable configuration object for connecting to an svn:// server.
RaSvnSession
A connected, stateful session to an svn:// server.
RecordedTextDelta
A fully recorded textdelta stream for one file token.
ReplayOptions
Options for crate::RaSvnSession::replay.
ReplayRangeOptions
Options for crate::RaSvnSession::replay_range.
Report
A sequence of ReportCommand values.
RepositoryInfo
Repository metadata returned by the server.
ServerError
A structured server error returned by svnserve.
ServerErrorItem
One error entry as returned by a server-side failure response.
ServerInfo
Information negotiated during the initial handshake.
SessionPool
A bounded pool of connected RaSvnSession values.
SessionPoolConfig
Configuration for SessionPool.
SessionPoolKey
A key used by SessionPools to partition pools by host:port and an optional custom key.
SessionPools
A map of SessionPool values partitioned by host:port and an optional key.
SshConfigssh
Configuration for the svn+ssh:// transport.
StatEntry
A stat result entry.
StatusOptions
Options for crate::RaSvnSession::status.
SvnUrl
A normalized Subversion repository URL.
SwitchOptions
Options for crate::RaSvnSession::switch.
TextDeltaApplier
Incrementally applies an svndiff textdelta to a base file.
TextDeltaApplierSync
Incrementally applies an svndiff textdelta to a base file, writing to a synchronous std::io::Write.
TextDeltaRecorder
Records apply-textdelta streams from an editor drive.
TokioFsEditor
Applies update/switch/replay-style editor drives to a filesystem directory using async tokio::fs I/O.
UnlockManyOptions
Options for crate::RaSvnSession::unlock_many.
UnlockOptions
Options for crate::RaSvnSession::unlock.
UnlockTarget
An unlock target for crate::RaSvnSession::unlock_many.
UpdateOptions
Options for crate::RaSvnSession::update.

Enums§

Capability
A protocol capability that may be announced during handshake.
Depth
Subversion depth value (used by list, update, switch, status, etc.).
DirentField
Fields to request for directory entries when using the list capability.
EditorCommand
Client-to-server editor commands for crate::RaSvnSession::commit.
EditorEvent
Server-to-client editor events returned by report-driven operations.
LogRevProps
Which revision properties to request for log operations.
MergeInfoInheritance
Controls how mergeinfo may be inherited when requesting mergeinfo.
NodeKind
The kind of a node in the repository.
ReportCommand
Client-to-server report commands used by operations like update/switch.
SessionPoolHealthCheck
Health check behavior for SessionPool idle sessions.
SshAuthssh
SSH authentication options for svn+ssh:// transports.
SshHostKeyPolicyssh
SSH host key verification policy.
SvnError
Errors returned by this crate.
SvndiffMode
Svndiff version selection for CommitBuilder.

Traits§

AsyncEditorEventHandler
Async handler for server-to-client EditorEvent streams.
EditorEventHandler
Handler for server-to-client EditorEvent streams.

Functions§

apply_textdelta
Applies an svndiff textdelta (svndiff0/1/2) to base and writes the result to out.
apply_textdelta_sync
Applies an svndiff textdelta (svndiff0/1/2) to base and writes the result to out.

Type Aliases§

MergeInfoCatalog
A map of path -> mergeinfo strings as returned by get-mergeinfo.
PropertyList
A Subversion property list (name -> raw bytes).
Result
Convenience alias for results returned by this crate.