##// END OF EJS Templates
rust-chg: add interface to chdir the server
Yuya Nishihara -
r40014:045ea159 default
parent child Browse files
Show More
@@ -6,8 +6,11 b''
6 //! cHg extensions to command server client.
6 //! cHg extensions to command server client.
7
7
8 use std::ffi::OsStr;
8 use std::ffi::OsStr;
9 use std::os::unix::ffi::OsStrExt;
9 use std::os::unix::io::AsRawFd;
10 use std::os::unix::io::AsRawFd;
11 use std::path::Path;
10 use tokio_hglib::{Client, Connection};
12 use tokio_hglib::{Client, Connection};
13 use tokio_hglib::protocol::OneShotRequest;
11
14
12 use super::attachio::AttachIo;
15 use super::attachio::AttachIo;
13 use super::message;
16 use super::message;
@@ -23,6 +26,10 b' pub trait ChgClientExt<C>'
23 O: AsRawFd,
26 O: AsRawFd,
24 E: AsRawFd;
27 E: AsRawFd;
25
28
29 /// Changes the working directory of the server.
30 fn set_current_dir<P>(self, dir: P) -> OneShotRequest<C>
31 where P: AsRef<Path>;
32
26 /// Runs the specified Mercurial command with cHg extension.
33 /// Runs the specified Mercurial command with cHg extension.
27 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
34 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
28 where I: IntoIterator<Item = P>,
35 where I: IntoIterator<Item = P>,
@@ -41,6 +48,12 b' impl<C> ChgClientExt<C> for Client<C>'
41 AttachIo::with_client(self, stdin, stdout, Some(stderr))
48 AttachIo::with_client(self, stdin, stdout, Some(stderr))
42 }
49 }
43
50
51 fn set_current_dir<P>(self, dir: P) -> OneShotRequest<C>
52 where P: AsRef<Path>,
53 {
54 OneShotRequest::start_with_args(self, b"chdir", dir.as_ref().as_os_str().as_bytes())
55 }
56
44 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
57 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
45 where I: IntoIterator<Item = P>,
58 where I: IntoIterator<Item = P>,
46 P: AsRef<OsStr>,
59 P: AsRef<OsStr>,
General Comments 0
You need to be logged in to leave comments. Login now