Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This feature gates (at compile-time) the use of the newly-added dirstate tree.
  
  The motivation for this is that the dirstate tree is currently *very* slow;
  replacing the current hashmap-based dirstate is not a viable solution in terms
  of performance... and why would you be using the Rust implementation if not
  for performance?
  
  The feature will also help reviewers better understand the differences that
  will slowly appear as the dirstate tree gets better.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  Makefile
  contrib/heptapod-ci.yml
  rust/README.rst
  rust/hg-core/Cargo.toml
  rust/hg-core/src/dirstate.rs
  rust/hg-cpython/Cargo.toml

CHANGE DETAILS

diff --git a/rust/hg-cpython/Cargo.toml b/rust/hg-cpython/Cargo.toml
--- a/rust/hg-cpython/Cargo.toml
+++ b/rust/hg-cpython/Cargo.toml
@@ -10,6 +10,7 @@
 
 [features]
 default = ["python27"]
+dirstate-tree = ["hg-core/dirstate-tree"]
 
 # Features to build an extension module:
 python27 = ["cpython/python27-sys", "cpython/extension-module-2-7"]
diff --git a/rust/hg-core/src/dirstate.rs b/rust/hg-core/src/dirstate.rs
--- a/rust/hg-core/src/dirstate.rs
+++ b/rust/hg-core/src/dirstate.rs
@@ -11,6 +11,7 @@
 
 pub mod dirs_multiset;
 pub mod dirstate_map;
+#[cfg(feature = "dirstate-tree")]
 pub mod dirstate_tree;
 pub mod parsers;
 pub mod status;
diff --git a/rust/hg-core/Cargo.toml b/rust/hg-core/Cargo.toml
--- a/rust/hg-core/Cargo.toml
+++ b/rust/hg-core/Cargo.toml
@@ -40,3 +40,9 @@
 clap = "*"
 pretty_assertions = "0.6.1"
 tempfile = "3.1.0"
+
+[features]
+# Use a (still unoptimized) tree for the dirstate instead of the current flat
+# dirstate. This is not yet recommended for performance reasons. A future
+# version might make it the default, or make it a runtime option.
+dirstate-tree = []
diff --git a/rust/README.rst b/rust/README.rst
--- a/rust/README.rst
+++ b/rust/README.rst
@@ -34,6 +34,15 @@
 One day we may use this environment variable to switch to new experimental
 binding crates like a hypothetical ``HGWITHRUSTEXT=hpy``.
 
+Special features
+================
+
+You might want to check the `features` section in ``hg-cpython/Cargo.toml``.
+It may contain features that might be interesting to try out.
+
+To use features from the Makefile, use the `HG_RUST_FEATURES` environment 
+variable: for instance `HG_RUST_FEATURES="some-feature other-feature"`
+
 Profiling
 =========
 
diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml
--- a/contrib/heptapod-ci.yml
+++ b/contrib/heptapod-ci.yml
@@ -41,6 +41,12 @@
     variables:
         PYTHON: python3
 
+rust-cargo-test-py3-dirstate-tree:
+    <<: *rust_cargo_test
+    variables:
+        PYTHON: python3
+        HG_RUST_FEATURES: dirstate-tree
+
 test-py2:
     <<: *runtests
     variables:
@@ -82,6 +88,15 @@
         PYTHON: python3
         TEST_HGMODULEPOLICY: "rust+c"
 
+test-py3-rust-dirstate-tree:
+    <<: *runtests
+    variables:
+        HGWITHRUSTEXT: cpython
+        RUNTEST_ARGS: "--rust --blacklist /tmp/check-tests.txt"
+        PYTHON: python3
+        TEST_HGMODULEPOLICY: "rust+c"
+        HG_RUST_FEATURES: "dirstate-tree"
+
 test-py2-chg:
     <<: *runtests
     variables:
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -133,7 +133,7 @@
 rust-tests:
        cd $(HGROOT)/rust/hg-cpython \
                && $(CARGO) test --quiet --all \
-                       --no-default-features --features "$(py_feature)"
+                       --no-default-features --features "$(py_feature) 
$(HG_RUST_FEATURES)"
 
 check-code:
        hg manifest | xargs python contrib/check-code.py



To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to