Patchwork D8300: rust-status: add trace-level logging for Rust status fallback for debugging

login
register
mail settings
Submitter phabricator
Date March 19, 2020, 8:46 a.m.
Message ID <23d9fda418e117f51fdf2862c96bbdb8@localhost.localdomain>
Download mbox | patch
Permalink /patch/45829/
State Not Applicable
Headers show

Comments

phabricator - March 19, 2020, 8:46 a.m.
Closed by commit rHG245aec57d76a: rust-status: add trace-level logging for Rust status fallback for debugging (authored by Alphare).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8300?vs=20824&id=20832

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8300/new/

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

AFFECTED FILES
  rust/Cargo.lock
  rust/hg-cpython/Cargo.toml
  rust/hg-cpython/src/dirstate/status.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/rust/hg-cpython/src/dirstate/status.rs b/rust/hg-cpython/src/dirstate/status.rs
--- a/rust/hg-cpython/src/dirstate/status.rs
+++ b/rust/hg-cpython/src/dirstate/status.rs
@@ -84,7 +84,10 @@ 
 fn handle_fallback(py: Python, err: StatusError) -> PyErr {
     match err {
         StatusError::Pattern(e) => {
-            PyErr::new::<FallbackError, _>(py, e.to_string())
+            let as_string = e.to_string();
+            log::trace!("Rust status fallback: `{}`", &as_string);
+
+            PyErr::new::<FallbackError, _>(py, &as_string)
         }
         e => PyErr::new::<ValueError, _>(py, e.to_string()),
     }
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
@@ -24,6 +24,7 @@ 
 [dependencies]
 hg-core = { path = "../hg-core"}
 libc = '*'
+log = "0.4.8"
 simple_logger = "1.6.0"
 
 [dependencies.cpython]
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -253,6 +253,7 @@ 
  "cpython 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "hg-core 0.1.0",
  "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "simple_logger 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]