Patchwork D8610: rhg: add rhg crate

login
register
mail settings
Submitter phabricator
Date June 5, 2020, 2:33 p.m.
Message ID <differential-rev-PHID-DREV-6sy64ruhqhmksz7q5owk-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46476/
State Superseded
Headers show

Comments

phabricator - June 5, 2020, 2:33 p.m.
acezar created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The goal of rhg is to speedup some of hg's commands when possible by bypassing
  python entirely for the time being.
  It is by no means a replacement for hg as it will not support extentions or
  configuration and implement only a subset of hg's commands and options.
  Only use rhg if you understand what the tradeoffs are.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8610

AFFECTED FILES
  rust/Cargo.lock
  rust/Cargo.toml
  rust/rhg/Cargo.toml
  rust/rhg/README.md
  rust/rhg/rustfmt.toml
  rust/rhg/src/exitcode.rs
  rust/rhg/src/main.rs

CHANGE DETAILS




To: acezar, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs
new file mode 100644
--- /dev/null
+++ b/rust/rhg/src/main.rs
@@ -0,0 +1,5 @@ 
+mod exitcode;
+
+fn main() {
+    std::process::exit(exitcode::UNIMPLEMENTED_COMMAND)
+}
diff --git a/rust/rhg/src/exitcode.rs b/rust/rhg/src/exitcode.rs
new file mode 100644
--- /dev/null
+++ b/rust/rhg/src/exitcode.rs
@@ -0,0 +1,4 @@ 
+pub type ExitCode = i32;
+
+/// Command not implemented by rhg
+pub const UNIMPLEMENTED_COMMAND: ExitCode = 252;
diff --git a/rust/rhg/rustfmt.toml b/rust/rhg/rustfmt.toml
new file mode 100644
--- /dev/null
+++ b/rust/rhg/rustfmt.toml
@@ -0,0 +1,3 @@ 
+max_width = 79
+wrap_comments = true
+error_on_line_overflow = true
diff --git a/rust/rhg/README.md b/rust/rhg/README.md
new file mode 100644
--- /dev/null
+++ b/rust/rhg/README.md
@@ -0,0 +1,4 @@ 
+# rhg
+
+This project provides a fastpath Rust implementation of the Mercurial (`hg`)
+version control tool.
diff --git a/rust/rhg/Cargo.toml b/rust/rhg/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/rust/rhg/Cargo.toml
@@ -0,0 +1,8 @@ 
+[package]
+name = "rhg"
+version = "0.1.0"
+authors = ["Antoine Cezar <antoine.cezar@octobus.net>"]
+edition = "2018"
+
+[dependencies]
+
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -1,3 +1,3 @@ 
 [workspace]
-members = ["hg-core", "hg-cpython"]
+members = ["hg-core", "hg-cpython", "rhg"]
 exclude = ["chg", "hgcli"]
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -487,6 +487,10 @@ 
 ]
 
 [[package]]
+name = "rhg"
+version = "0.1.0"
+
+[[package]]
 name = "rustc_version"
 version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"