use crate::error::{Error, Result};
use crate::registry::Identity;
use crate::session::{
PreservedBranch, Provenance, Recoverable, Scope, Session, SessionRequest, SessionToken,
};
pub trait Vcs {
fn resolve_identity(&self, origin_or_path: &str) -> Result<Identity>;
fn open_session(&self, req: SessionRequest) -> Result<Session>;
fn adopt_session(&self, token: SessionToken) -> Result<Session>;
fn preserve(&self, s: &Session, provenance: Provenance) -> Result<PreservedBranch>;
fn recoverable(&self, scope: Scope) -> Result<Vec<Recoverable>>;
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct Git;
impl Vcs for Git {
fn resolve_identity(&self, _origin_or_path: &str) -> Result<Identity> {
Err(Error::NotImplemented {
operation: "Vcs::resolve_identity",
})
}
fn open_session(&self, _req: SessionRequest) -> Result<Session> {
Err(Error::NotImplemented {
operation: "Vcs::open_session",
})
}
fn adopt_session(&self, _token: SessionToken) -> Result<Session> {
Err(Error::NotImplemented {
operation: "Vcs::adopt_session",
})
}
fn preserve(&self, _s: &Session, _provenance: Provenance) -> Result<PreservedBranch> {
Err(Error::NotImplemented {
operation: "Vcs::preserve",
})
}
fn recoverable(&self, _scope: Scope) -> Result<Vec<Recoverable>> {
Err(Error::NotImplemented {
operation: "Vcs::recoverable",
})
}
}