Mercurial > hg-stable
changeset 39968:aab43d5861bb
rust-chg: add project skeleton
This directory will host the reimplementation of cHg in Rust. It will use
Tokio [1], and tokio-hglib [2] which I wrote for an oxidized CHg, no idea
if there's such carbon bonding in nature btw.
[1]: https://tokio.rs/
[2]: https://bitbucket.org/yuja/tokio-hglib/
The reasoning for depending on Tokio is that it will allow us to handle Unix
signals in a safer way. Well, I believed that until I found a weird function,
handlestopsignal(), in cHg codebase. It resends the same signal to the same
process by temporarily masking the handler, which can't be inherently async.
So the signal handlers will stay in C, which means there isn't actually much
reason to write async code right now, other than I've already done most of
the async stuff, and slightly easier pager handling.
The reasoning for the rewrite is that it will eventually be possible to port
server-side config validation back to the client side, which will reduce
the complexity of the current daemon management. It will also encourage us
to write frontend library (e.g. command line and config parsers) in Rust.
The license is GPL2+ because it's likely to include derived work from the
cHg of C. The rust/chg crate is excluded from the root workspace as it's
unclear how the whole rust packages should be laid out. That can be revisited
later.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 24 Sep 2018 15:54:18 +0900 |
parents | 707c3804e607 |
children | 86acdfe8b018 |
files | .hgignore rust/Cargo.toml rust/chg/Cargo.toml rust/chg/src/lib.rs rust/chg/src/main.rs |
diffstat | 4 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Fri Sep 28 12:56:57 2018 -0700 +++ b/.hgignore Mon Sep 24 15:54:18 2018 +0900 @@ -56,6 +56,7 @@ hgext/__index__.py rust/target/ +rust/*/target/ # Generated wheels wheelhouse/
--- a/rust/Cargo.toml Fri Sep 28 12:56:57 2018 -0700 +++ b/rust/Cargo.toml Mon Sep 24 15:54:18 2018 +0900 @@ -1,2 +1,3 @@ [workspace] members = ["hgcli"] +exclude = ["chg"]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust/chg/Cargo.toml Mon Sep 24 15:54:18 2018 +0900 @@ -0,0 +1,18 @@ +[package] +name = "chg" +version = "0.1.0" +authors = ["Yuya Nishihara <yuya@tcha.org>"] +description = "Client for Mercurial command server with cHg extension" +license = "GPL-2.0+" + +[dependencies] +bytes = "0.4" +futures = "0.1" +libc = "0.2" +tokio = "0.1" +tokio-hglib = "0.2" +# TODO: "^0.2.3" once released. we need AsRawFd support. +tokio-process = { git = "https://github.com/alexcrichton/tokio-process" } + +[build-dependencies] +cc = "1.0"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust/chg/src/main.rs Mon Sep 24 15:54:18 2018 +0900 @@ -0,0 +1,7 @@ +// Copyright 2018 Yuya Nishihara <yuya@tcha.org> +// +// This software may be used and distributed according to the terms of the +// GNU General Public License version 2 or any later version. + +fn main() { +}