--- a/rust/chg/src/clientext.rs Sun Oct 07 16:14:21 2018 +0900
+++ b/rust/chg/src/clientext.rs Thu Oct 04 22:44:37 2018 +0900
@@ -5,9 +5,10 @@
//! cHg extensions to command server client.
-use bytes::Bytes;
+use bytes::{BufMut, Bytes, BytesMut};
use std::ffi::OsStr;
use std::io;
+use std::mem;
use std::os::unix::ffi::OsStrExt;
use std::os::unix::io::AsRawFd;
use std::path::Path;
@@ -41,6 +42,9 @@
I: IntoIterator<Item = (P, P)>,
P: AsRef<OsStr>;
+ /// Changes the umask of the server process.
+ fn set_umask(self, mask: u32) -> OneShotRequest<C>;
+
/// Runs the specified Mercurial command with cHg extension.
fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
where
@@ -90,6 +94,12 @@
OneShotRequest::start_with_args(self, b"setenv", message::pack_env_vars_os(vars))
}
+ fn set_umask(self, mask: u32) -> OneShotRequest<C> {
+ let mut args = BytesMut::with_capacity(mem::size_of_val(&mask));
+ args.put_u32_be(mask);
+ OneShotRequest::start_with_args(self, b"setumask2", args)
+ }
+
fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
where
I: IntoIterator<Item = P>,