comparison rust/chg/src/locator.rs @ 44684:80d6e3415636

rust-chg: update name of the server process This is a copy of updateprocname() of hgclient.c. At this point, rust-chg is basically functional. I did dogfooding for a couple of weeks in 2018. There are a few remaining tasks: a. loop detection by CHGINTERNALMARK b. forward unsupported commands (notably serve -d) to real hg c. better handling of early server exception d. modernize codebase (2018 edition, impl trait, async/await) For (d), we'll probably want to switch to async-std, but I'm thinking of upgrading to Tokio 0.2 as an intermediate step since process API isn't ported to async-std yet. I'm pretty sure future migration to async-std will be painless compared to the mass rewrite from futures-0.1 to 0.3. https://github.com/async-rs/async-std/issues/22 Differential Revision: https://phab.mercurial-scm.org/D8383
author Yuya Nishihara <yuya@tcha.org>
date Mon, 19 Nov 2018 20:50:45 +0900
parents 065048e66f32
children 1f5ab1a9363d
comparison
equal deleted inserted replaced
44683:065048e66f32 44684:80d6e3415636
192 } 192 }
193 }) 193 })
194 .and_then(|(loc, client)| { 194 .and_then(|(loc, client)| {
195 check_server_capabilities(client.server_spec())?; 195 check_server_capabilities(client.server_spec())?;
196 Ok((loc, client)) 196 Ok((loc, client))
197 })
198 .and_then(|(loc, client)| {
199 // It's purely optional, and the server might not support this command.
200 if client.server_spec().capabilities.contains("setprocname") {
201 let fut = client
202 .set_process_name(format!("chg[worker/{}]", loc.process_id))
203 .map(|client| (loc, client));
204 Either::A(fut)
205 } else {
206 Either::B(future::ok((loc, client)))
207 }
197 }) 208 })
198 .and_then(|(loc, client)| { 209 .and_then(|(loc, client)| {
199 client 210 client
200 .set_current_dir(&loc.current_dir) 211 .set_current_dir(&loc.current_dir)
201 .map(|client| (loc, client)) 212 .map(|client| (loc, client))