Alphare created this revision. Alphare added a comment. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
Pending CI refresh REVISION SUMMARY We use the `trace` level for the actual message because it can get really busy. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11814 AFFECTED FILES rust/rhg/src/main.rs rust/rhg/src/ui.rs CHANGE DETAILS diff --git a/rust/rhg/src/ui.rs b/rust/rhg/src/ui.rs --- a/rust/rhg/src/ui.rs +++ b/rust/rhg/src/ui.rs @@ -130,3 +130,9 @@ let bytes = s.as_bytes(); Cow::Borrowed(bytes) } + +/// Decode user system bytes to Rust string. +pub fn local_to_utf8(s: &[u8]) -> Cow<str> { + // TODO decode from the user's system // + String::from_utf8_lossy(s) +} diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs +++ b/rust/rhg/src/main.rs @@ -1,4 +1,5 @@ extern crate log; +use crate::ui::local_to_utf8; use crate::ui::Ui; use clap::App; use clap::AppSettings; @@ -358,7 +359,7 @@ ) -> ! { if let ( OnUnsupported::Fallback { executable }, - Err(CommandError::UnsupportedFeature { .. }), + Err(CommandError::UnsupportedFeature { message }), ) = (&on_unsupported, &result) { let mut args = std::env::args_os(); @@ -374,6 +375,8 @@ )); on_unsupported = OnUnsupported::Abort } else { + log::debug!("falling back (see trace-level log)"); + log::trace!("{}", local_to_utf8(message)); // `args` is now `argv[1..]` since we’ve already consumed `argv[0]` let mut command = Command::new(executable_path); command.args(args); 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