annotate rust/chg/src/clientext.rs @ 41486:f9150901267c

run-tests: sort the skip, failure and error lists in the final output This will help keep the lists consistent, for comparison across runs.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 30 Jan 2019 19:20:31 -0500
parents 045ea159418d
children ce088b38f92b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39977
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
1 // Copyright 2018 Yuya Nishihara <yuya@tcha.org>
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
2 //
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
3 // This software may be used and distributed according to the terms of the
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
4 // GNU General Public License version 2 or any later version.
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
5
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
6 //! cHg extensions to command server client.
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
7
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
8 use std::ffi::OsStr;
39978
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
9 use std::os::unix::ffi::OsStrExt;
39977
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
10 use std::os::unix::io::AsRawFd;
39978
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
11 use std::path::Path;
39977
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
12 use tokio_hglib::{Client, Connection};
39978
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
13 use tokio_hglib::protocol::OneShotRequest;
39977
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
14
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
15 use super::attachio::AttachIo;
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
16 use super::message;
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
17 use super::runcommand::ChgRunCommand;
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
18 use super::uihandler::SystemHandler;
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
19
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
20 pub trait ChgClientExt<C>
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
21 where C: Connection + AsRawFd,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
22 {
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
23 /// Attaches the client file descriptors to the server.
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
24 fn attach_io<I, O, E>(self, stdin: I, stdout: O, stderr: E) -> AttachIo<C, I, O, E>
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
25 where I: AsRawFd,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
26 O: AsRawFd,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
27 E: AsRawFd;
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
28
39978
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
29 /// Changes the working directory of the server.
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
30 fn set_current_dir<P>(self, dir: P) -> OneShotRequest<C>
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
31 where P: AsRef<Path>;
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
32
39977
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
33 /// Runs the specified Mercurial command with cHg extension.
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
34 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
35 where I: IntoIterator<Item = P>,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
36 P: AsRef<OsStr>,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
37 H: SystemHandler;
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
38 }
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
39
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
40 impl<C> ChgClientExt<C> for Client<C>
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
41 where C: Connection + AsRawFd,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
42 {
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
43 fn attach_io<I, O, E>(self, stdin: I, stdout: O, stderr: E) -> AttachIo<C, I, O, E>
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
44 where I: AsRawFd,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
45 O: AsRawFd,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
46 E: AsRawFd,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
47 {
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
48 AttachIo::with_client(self, stdin, stdout, Some(stderr))
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
49 }
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
50
39978
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
51 fn set_current_dir<P>(self, dir: P) -> OneShotRequest<C>
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
52 where P: AsRef<Path>,
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
53 {
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
54 OneShotRequest::start_with_args(self, b"chdir", dir.as_ref().as_os_str().as_bytes())
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
55 }
045ea159418d rust-chg: add interface to chdir the server
Yuya Nishihara <yuya@tcha.org>
parents: 39977
diff changeset
56
39977
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
57 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
58 where I: IntoIterator<Item = P>,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
59 P: AsRef<OsStr>,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
60 H: SystemHandler,
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
61 {
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
62 ChgRunCommand::with_client(self, handler, message::pack_args_os(args))
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
63 }
74da9d999cd7 rust-chg: add Client extensions to run cHg-specific requests
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
64 }