##// END OF EJS Templates
rust-status: use bare hg status fastpath from Python...
rust-status: use bare hg status fastpath from Python This change also adds a test case for subrepos. Repeating the benchmark information from the `hg-core` commit: On the Netbeans repository: C: 840ms Rust+C: 556ms Mozilla Central with the one pattern that causes a fallback removed: C: 2.315s Rust+C: 1.700s Differential Revision: https://phab.mercurial-scm.org/D7931

File last commit:

r44270:ce088b38 default
r45017:4d1634e5 default
Show More
clientext.rs
72 lines | 2.0 KiB | application/rls-services+xml | RustLexer
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 // Copyright 2018 Yuya Nishihara <yuya@tcha.org>
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
//! cHg extensions to command server client.
use std::ffi::OsStr;
Yuya Nishihara
rust-chg: add interface to chdir the server
r40014 use std::os::unix::ffi::OsStrExt;
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 use std::os::unix::io::AsRawFd;
Yuya Nishihara
rust-chg: add interface to chdir the server
r40014 use std::path::Path;
Gregory Szorc
rust: run rustfmt...
r44270 use tokio_hglib::protocol::OneShotRequest;
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 use tokio_hglib::{Client, Connection};
use super::attachio::AttachIo;
use super::message;
use super::runcommand::ChgRunCommand;
use super::uihandler::SystemHandler;
pub trait ChgClientExt<C>
Gregory Szorc
rust: run rustfmt...
r44270 where
C: Connection + AsRawFd,
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 {
/// Attaches the client file descriptors to the server.
fn attach_io<I, O, E>(self, stdin: I, stdout: O, stderr: E) -> AttachIo<C, I, O, E>
Gregory Szorc
rust: run rustfmt...
r44270 where
I: AsRawFd,
O: AsRawFd,
E: AsRawFd;
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013
Yuya Nishihara
rust-chg: add interface to chdir the server
r40014 /// Changes the working directory of the server.
fn set_current_dir<P>(self, dir: P) -> OneShotRequest<C>
Gregory Szorc
rust: run rustfmt...
r44270 where
P: AsRef<Path>;
Yuya Nishihara
rust-chg: add interface to chdir the server
r40014
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 /// Runs the specified Mercurial command with cHg extension.
fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
Gregory Szorc
rust: run rustfmt...
r44270 where
I: IntoIterator<Item = P>,
P: AsRef<OsStr>,
H: SystemHandler;
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 }
impl<C> ChgClientExt<C> for Client<C>
Gregory Szorc
rust: run rustfmt...
r44270 where
C: Connection + AsRawFd,
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 {
fn attach_io<I, O, E>(self, stdin: I, stdout: O, stderr: E) -> AttachIo<C, I, O, E>
Gregory Szorc
rust: run rustfmt...
r44270 where
I: AsRawFd,
O: AsRawFd,
E: AsRawFd,
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 {
AttachIo::with_client(self, stdin, stdout, Some(stderr))
}
Yuya Nishihara
rust-chg: add interface to chdir the server
r40014 fn set_current_dir<P>(self, dir: P) -> OneShotRequest<C>
Gregory Szorc
rust: run rustfmt...
r44270 where
P: AsRef<Path>,
Yuya Nishihara
rust-chg: add interface to chdir the server
r40014 {
OneShotRequest::start_with_args(self, b"chdir", dir.as_ref().as_os_str().as_bytes())
}
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
Gregory Szorc
rust: run rustfmt...
r44270 where
I: IntoIterator<Item = P>,
P: AsRef<OsStr>,
H: SystemHandler,
Yuya Nishihara
rust-chg: add Client extensions to run cHg-specific requests...
r40013 {
ChgRunCommand::with_client(self, handler, message::pack_args_os(args))
}
}