Struct Client

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

pub fn open<P: AsRef<Path>>( path: P, encoding: &str, configs: &[&str], ) -> Result<Client, HglibError>

Open a new hglib client

§Example
extern crate hglib;

use hglib::{commit, hg, init, log, Basic, Client, HG};
use std::fs::File;
use std::io::Write;

fn main() {
    let path = "my_hg_repo";
    assert!(HG!(init, dest = &path).is_ok());

    let mut client = Client::open(&path, "UTF-8", &[]).unwrap();
    let path = client.get_path();

    let mut file = File::create(path.join("hello.world")).unwrap();
    file.write_all(b"Hello, world!").unwrap();

    hg!(
        client,
        commit,
        message = "My first commit",
        addremove = true,
        user = "foo@bar.com"
    )
    .unwrap();

    let rev = hg!(client, log).unwrap();

    println!("{:?}", rev);
}
Source

pub fn close(&mut self) -> Result<(), HglibError>

Close the client

Source

pub fn get_path(&self) -> &PathBuf

Get the canonicalized path for this repository

Source

pub fn encoding(&self) -> &str

Source§

impl Client

Source

pub fn add(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn addremove(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn annotate(&mut self, x: Arg<'_>) -> Result<Lines, HglibError>

Source§

impl Client

Source

pub fn archive(&mut self, x: Arg<'_>) -> Result<(), HglibError>

Source§

impl Client

Source

pub fn backout(&mut self, x: Arg<'_>) -> Result<(), HglibError>

Source§

impl Client

Source

pub fn bookmark(&mut self, x: Arg<'_>) -> Result<(), HglibError>

Source§

impl Client

Source

pub fn bookmarks(&mut self, x: Arg) -> Result<Bookmarks, HglibError>

Source§

impl Client

Source

pub fn branch(&mut self, x: Arg<'_>) -> Result<String, HglibError>

Source§

impl Client

Source

pub fn branches(&mut self, x: Arg) -> Result<Vec<Branch>, HglibError>

Source§

impl Client

Source

pub fn bundle(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn cat(&mut self, x: Arg<'_>) -> Result<Option<Vec<u8>>, HglibError>

Source§

impl Client

Source

pub fn clone(&mut self, x: Arg<'_>) -> Result<(), HglibError>

Source§

impl Client

Source

pub fn commit(&mut self, x: Arg<'_>) -> Result<Commit, HglibError>

Source§

impl Client

Source

pub fn config(&mut self, x: Arg<'_>) -> Result<Vec<Config>, HglibError>

Source§

impl Client

Source

pub fn copy(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn diff(&mut self, x: Arg<'_>) -> Result<Vec<u8>, HglibError>

Source§

impl Client

Source

pub fn export(&mut self, x: Arg<'_>) -> Result<Option<Vec<u8>>, HglibError>

Source§

impl Client

Source

pub fn forget(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn grep(&mut self, x: Arg<'_>) -> Result<Vec<GrepRes>, HglibError>

Source§

impl Client

Source

pub fn heads(&mut self, x: Arg<'_>) -> Result<Vec<Revision>, HglibError>

Source§

impl Client

Source

pub fn identify(&mut self, x: Arg<'_>) -> Result<Vec<u8>, HglibError>

Source§

impl Client

Source

pub fn import(&mut self, x: Arg<'_>) -> Result<Vec<u8>, HglibError>

Source§

impl Client

Source

pub fn incoming(&mut self, x: Arg<'_>) -> Result<Incoming, HglibError>

Source§

impl Client

Source

pub fn init(&mut self, x: Arg<'_>) -> Result<(), HglibError>

Source§

impl Client

Source

pub fn log<'a>(&mut self, x: Arg<'a>) -> Result<Vec<Revision>, HglibError>

Source§

impl Client

Source

pub fn manifest(&mut self, x: Arg<'_>) -> Result<Manifest, HglibError>

Source§

impl Client

Source

pub fn merge(&mut self, x: Arg<'_>) -> Result<(), HglibError>

Source§

impl Client

Source

pub fn move(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn outgoing(&mut self, x: Arg<'_>) -> Result<Outgoing, HglibError>

Source§

impl Client

Source

pub fn parents(&mut self, x: Arg<'_>) -> Result<Vec<Revision>, HglibError>

Source§

impl Client

Source

pub fn paths(&mut self, x: Arg<'_>) -> Result<Paths, HglibError>

Source§

impl Client

Source

pub fn phase(&mut self, x: Arg<'_>) -> Result<Option<Vec<Phase>>, HglibError>

Source§

impl Client

Source

pub fn pull(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn push(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn remove(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn resolve( &mut self, x: Arg<'_>, ) -> Result<Option<Vec<Resolve>>, HglibError>

Source§

impl Client

Source

pub fn revert(&mut self, x: Arg<'_>) -> Result<bool, HglibError>

Source§

impl Client

Source

pub fn root(&mut self, x: Arg) -> Result<String, HglibError>

Source§

impl Client

Source

pub fn status(&mut self, x: Arg<'_>) -> Result<Vec<Status>, HglibError>

Source§

impl Client

Source

pub fn summary(&mut self, x: Arg) -> Result<Summary, HglibError>

Source§

impl Client

Source

pub fn tag(&mut self, x: Arg<'_>) -> Result<(), HglibError>

Source§

impl Client

Source

pub fn tags(&mut self, x: Arg) -> Result<Vec<Tag>, HglibError>

Source§

impl Client

Source

pub fn tip(&mut self, x: Arg) -> Result<Revision, HglibError>

Source§

impl Client

Source

pub fn update(&mut self, x: Arg<'_>) -> Result<Update, HglibError>

Source§

impl Client

Source

pub fn version(&mut self, x: Arg) -> Result<Version, HglibError>

Trait Implementations§

Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Client

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Runner for Client

Source§

fn runcommand<'a>( &mut self, args: &'a [&str], prompt: Option<Box<dyn Prompt + 'a>>, ) -> Result<(Vec<u8>, i32), HglibError>

Run a command

Auto Trait Implementations§

§

impl Freeze for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnwindSafe for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.