Skip to content
Snippets Groups Projects
Commit 045ea159 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

rust-chg: add interface to chdir the server

parent 74da9d99
No related branches found
No related tags found
No related merge requests found
......@@ -6,4 +6,5 @@
//! cHg extensions to command server client.
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
use std::os::unix::io::AsRawFd;
......@@ -9,2 +10,3 @@
use std::os::unix::io::AsRawFd;
use std::path::Path;
use tokio_hglib::{Client, Connection};
......@@ -10,4 +12,5 @@
use tokio_hglib::{Client, Connection};
use tokio_hglib::protocol::OneShotRequest;
use super::attachio::AttachIo;
use super::message;
......@@ -23,6 +26,10 @@
O: AsRawFd,
E: AsRawFd;
/// Changes the working directory of the server.
fn set_current_dir<P>(self, dir: P) -> OneShotRequest<C>
where P: AsRef<Path>;
/// Runs the specified Mercurial command with cHg extension.
fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
where I: IntoIterator<Item = P>,
......@@ -41,6 +48,12 @@
AttachIo::with_client(self, stdin, stdout, Some(stderr))
}
fn set_current_dir<P>(self, dir: P) -> OneShotRequest<C>
where P: AsRef<Path>,
{
OneShotRequest::start_with_args(self, b"chdir", dir.as_ref().as_os_str().as_bytes())
}
fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
where I: IntoIterator<Item = P>,
P: AsRef<OsStr>,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment