svn 0.1.8

Async Rust SVN client for Subversion svn://, svn+ssh://, and ra_svn workflows.
Documentation

svn-rs is an async Subversion client library for Rust. It talks to svnserve over svn://, optionally tunnels svn+ssh://, and exposes ra_svn read, report/editor, lock, and commit APIs. It is not a working copy implementation.

Highlights

  • Async-first RaSvnClient and RaSvnSession
  • Subversion svn:// support, plus optional svn+ssh://
  • ra_svn read operations, report/editor drives, locks, revision property updates, and low-level commit support
  • Structured server errors with code, message, file, line, and command context
  • Optional serde, cyrus-sasl, and ssh features

Install

[dependencies]
svn = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Optional features:

svn = { version = "0.1", features = ["serde", "ssh", "cyrus-sasl"] }

Example

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

#[tokio::main]
async fn main() -> svn::Result<()> {
    let url = SvnUrl::parse("svn://example.com/repo")?;

    let client = RaSvnClient::new(url, None, None)
        .with_connect_timeout(Duration::from_secs(10))
        .with_read_timeout(Duration::from_secs(30))
        .with_write_timeout(Duration::from_secs(30));

    let mut session = client.open_session().await?;
    let head = session.get_latest_rev().await?;
    println!("HEAD = {head}");

    Ok(())
}

Supported Operations

  • Read: revisions, files, directories, logs, locations, mergeinfo, properties, file revs, locks
  • Report/editor flows: update, switch, status, diff, replay, replay-range
  • Write: revision property changes, lock/unlock, and commit editor commands

Not included:

  • Working copy management
  • Native TLS for svn://
  • Full OpenSSH feature parity

Authentication And Transport

Built-in svn:// mechanisms:

  • ANONYMOUS
  • PLAIN
  • CRAM-MD5

cyrus-sasl enables Cyrus SASL auth and negotiated SASL security layers. ssh enables svn+ssh:// by running svnserve -t over SSH.

Examples

Examples live in examples/:

  • readonly
  • get_file
  • list
  • export
  • log_retry
  • commit
  • locks
  • ssh
  • sasl

Development

Run tests:

cargo test --all-features

Interop tests against a real svnserve:

SVN_INTEROP=1 cargo test --all-features --test interop_svnserve -- --nocapture

API docs: https://docs.rs/svn