[PATCH 01 of 13] rust-chg: add project skeleton

Gregory Szorc gregory.szorc at gmail.com
Tue Oct 2 15:12:09 EDT 2018


On Tue, Oct 2, 2018 at 7:32 AM Yuya Nishihara <yuya at tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1537772058 -32400
> #      Mon Sep 24 15:54:18 2018 +0900
> # Node ID 4cb12a1e78262428caec486fde361e562a205f63
> # Parent  1a7d901a0a0c6c93e738595b6b3ea59d3d04fdf2
> rust-chg: add project skeleton
>

Queued with delight!

I also am not sure what the final layout of the rust/ directory/workspace
will look like: I imagine that once we support `hg` as a Rust binary, we
may want some of this chg client functionality baked into `hg` itself. But
we can cross that bridge later: the important thing is to get working code
authored first. We can refactor later.


>
> 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.
>
> diff --git a/.hgignore b/.hgignore
> --- a/.hgignore
> +++ b/.hgignore
> @@ -56,6 +56,7 @@ locale/*/LC_MESSAGES/hg.mo
>  hgext/__index__.py
>
>  rust/target/
> +rust/*/target/
>
>  # Generated wheels
>  wheelhouse/
> diff --git a/rust/Cargo.toml b/rust/Cargo.toml
> --- a/rust/Cargo.toml
> +++ b/rust/Cargo.toml
> @@ -1,2 +1,3 @@
>  [workspace]
>  members = ["hgcli"]
> +exclude = ["chg"]
> diff --git a/rust/chg/Cargo.toml b/rust/chg/Cargo.toml
> new file mode 100644
> --- /dev/null
> +++ b/rust/chg/Cargo.toml
> @@ -0,0 +1,18 @@
> +[package]
> +name = "chg"
> +version = "0.1.0"
> +authors = ["Yuya Nishihara <yuya at 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"
> diff --git a/rust/chg/src/lib.rs b/rust/chg/src/lib.rs
> new file mode 100644
> diff --git a/rust/chg/src/main.rs b/rust/chg/src/main.rs
> new file mode 100644
> --- /dev/null
> +++ b/rust/chg/src/main.rs
> @@ -0,0 +1,7 @@
> +// Copyright 2018 Yuya Nishihara <yuya at 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() {
> +}
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20181002/0500fabc/attachment.html>


More information about the Mercurial-devel mailing list