debugindexstats: handle the lack of Rust support better
authorRaphaël Gomès <rgomes@octobus.net>
Tue, 31 Oct 2023 18:09:43 +0100
changeset 51232 3551f2a1c963
parent 51231 5807e3a8865e
child 51233 ca81cd96000a
debugindexstats: handle the lack of Rust support better We don't have any stats in the Rust index. Currently it is not known which stats would be interesting to get, so if they end up being important, we can add them later.
mercurial/debugcommands.py
rust/hg-cpython/src/revlog.rs
tests/test-debugcommands.t
--- a/mercurial/debugcommands.py	Tue Oct 31 17:36:59 2023 +0100
+++ b/mercurial/debugcommands.py	Tue Oct 31 18:09:43 2023 +0100
@@ -1860,7 +1860,7 @@
     repo.changelog.shortest(repo.nullid, 1)
     index = repo.changelog.index
     if not hasattr(index, 'stats'):
-        raise error.Abort(_(b'debugindexstats only works with native code'))
+        raise error.Abort(_(b'debugindexstats only works with native C code'))
     for k, v in sorted(index.stats().items()):
         ui.write(b'%s: %d\n' % (k, v))
 
--- a/rust/hg-cpython/src/revlog.rs	Tue Oct 31 17:36:59 2023 +0100
+++ b/rust/hg-cpython/src/revlog.rs	Tue Oct 31 18:09:43 2023 +0100
@@ -405,11 +405,6 @@
         Ok(rust_res)
     }
 
-    /// stats for the index
-    def stats(&self, *args, **kw) -> PyResult<PyObject> {
-        self.call_cindex(py, "stats", args, kw)
-    }
-
     // index_sequence_methods and index_mapping_methods.
     //
     // Since we call back through the high level Python API,
--- a/tests/test-debugcommands.t	Tue Oct 31 17:36:59 2023 +0100
+++ b/tests/test-debugcommands.t	Tue Oct 31 18:09:43 2023 +0100
@@ -185,12 +185,12 @@
 
 debugdelta chain basic output
 
-#if reporevlogstore pure
+#if reporevlogstore pure rust
   $ hg debugindexstats
-  abort: debugindexstats only works with native code
+  abort: debugindexstats only works with native C code
   [255]
 #endif
-#if reporevlogstore no-pure
+#if reporevlogstore no-pure no-rust
   $ hg debugindexstats
   node trie capacity: 4
   node trie count: 2