[Updated] D11814: rhg: signal when falling back in logs
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Tue Feb 15 17:05:31 UTC 2022
Closed by commit rHG3d8fa7cf3192: rhg: signal when falling back in logs (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11814?vs=32217&id=32219
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11814/new/
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
@@ -219,6 +219,13 @@
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)
+}
+
+
/// Should formatted output be used?
///
/// Note: rhg does not have the formatter mechanism yet,
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,6 +1,6 @@
extern crate log;
use crate::error::CommandError;
-use crate::ui::Ui;
+use crate::ui::{local_to_utf8, Ui};
use clap::App;
use clap::AppSettings;
use clap::Arg;
@@ -383,7 +383,7 @@
) -> ! {
if let (
OnUnsupported::Fallback { executable },
- Err(CommandError::UnsupportedFeature { .. }),
+ Err(CommandError::UnsupportedFeature { message }),
) = (&on_unsupported, &result)
{
let mut args = std::env::args_os();
@@ -413,6 +413,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);
To: Alphare, #hg-reviewers, marmoute
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220215/f55f97a7/attachment.html>
More information about the Mercurial-patches
mailing list