Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

Commit 6f6fb571 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

rust-chg: send client-side environment variables to server

This is also needed to run config validation.

The "validate" request and its response handling will be implemented in
the next batch.

Differential Revision: https://phab.mercurial-scm.org/D8364
parent 8a7beeea655f
Pipeline #4826 passed with stage
in 34 minutes and 13 seconds
......@@ -33,6 +33,12 @@ where
where
P: AsRef<Path>;
/// Updates the environment variables of the server.
fn set_env_vars_os<I, P>(self, vars: I) -> OneShotRequest<C>
where
I: IntoIterator<Item = (P, P)>,
P: AsRef<OsStr>;
/// Runs the specified Mercurial command with cHg extension.
fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
where
......@@ -61,6 +67,14 @@ where
OneShotRequest::start_with_args(self, b"chdir", dir.as_ref().as_os_str().as_bytes())
}
fn set_env_vars_os<I, P>(self, vars: I) -> OneShotRequest<C>
where
I: IntoIterator<Item = (P, P)>,
P: AsRef<OsStr>,
{
OneShotRequest::start_with_args(self, b"setenv", message::pack_env_vars_os(vars))
}
fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
where
I: IntoIterator<Item = P>,
......
......@@ -24,7 +24,7 @@ use super::clientext::ChgClientExt;
use super::message::ServerSpec;
use super::procutil;
const REQUIRED_SERVER_CAPABILITIES: &[&str] = &["attachio", "chdir", "runcommand"];
const REQUIRED_SERVER_CAPABILITIES: &[&str] = &["attachio", "chdir", "runcommand", "setenv"];
/// Helper to connect to and spawn a server process.
#[derive(Clone, Debug)]
......@@ -86,6 +86,11 @@ impl Locator {
.set_current_dir(&loc.current_dir)
.map(|client| (loc, client))
})
.and_then(|(loc, client)| {
client
.set_env_vars_os(loc.env_vars.iter().cloned())
.map(|client| (loc, client))
})
}
/// Spawns new server process and connects to it.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment