##// END OF EJS Templates
rust-index: expose a method to retrieve the C index...
rust-index: expose a method to retrieve the C index The code for `shortesthexnodeidprefix` need to access the actual C index. For now we grant its wish and expose a method to do so. Once we have the nodemap in Rust, we will be able to implement the same feature from rust and we will be able to drop this method. Differential Revision: https://phab.mercurial-scm.org/D7658

File last commit:

r44270:ce088b38 default
r44464:443dc165 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))
}
}