##// END OF EJS Templates
tests: check availability of pyflakes by trying to import pyflakes module...
tests: check availability of pyflakes by trying to import pyflakes module Since e397c6d74652, we use the pyflakes module instead of the pyflakes executable. As was pointed out during the review, the hghave check can be rewritten to try to import the pyflakes module instead of spawning a new subprocess.

File last commit:

r44270:ce088b38 default
r44987:aa0e1341 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))
}
}