[Updated] D11908: rhg: Print "bad match" errors in rhg status

SimonSapin phabricator at mercurial-scm.org
Mon Dec 13 15:02:23 UTC 2021


Closed by commit rHG23dfdd43d56d: rhg: Print "bad match" errors in rhg status (authored by SimonSapin).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11908?vs=31457&id=31463

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

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

AFFECTED FILES
  rust/rhg/src/commands/status.rs
  tests/test-permissions.t

CHANGE DETAILS

diff --git a/tests/test-permissions.t b/tests/test-permissions.t
--- a/tests/test-permissions.t
+++ b/tests/test-permissions.t
@@ -11,10 +11,6 @@
   > EOF
 #endif
 
-TODO: fix rhg bugs that make this test fail when status is enabled
-  $ unset RHG_STATUS
-
-
   $ hg init t
   $ cd t
 
@@ -82,7 +78,7 @@
 (fsmonitor makes "hg status" avoid accessing to "dir")
 
   $ hg status
-  dir: Permission denied
+  dir: Permission denied * (glob)
   M a
 
 #endif
diff --git a/rust/rhg/src/commands/status.rs b/rust/rhg/src/commands/status.rs
--- a/rust/rhg/src/commands/status.rs
+++ b/rust/rhg/src/commands/status.rs
@@ -237,8 +237,20 @@
         warn!("Pattern warnings: {:?}", &pattern_warnings);
     }
 
-    if !ds_status.bad.is_empty() {
-        warn!("Bad matches {:?}", &(ds_status.bad))
+    for (path, error) in ds_status.bad {
+        let error = match error {
+            hg::BadMatch::OsError(code) => {
+                std::io::Error::from_raw_os_error(code).to_string()
+            }
+            hg::BadMatch::BadType(ty) => {
+                format!("unsupported file type (type is {})", ty)
+            }
+        };
+        ui.write_stderr(&format_bytes!(
+            b"{}: {}\n",
+            path.as_bytes(),
+            error.as_bytes()
+        ))?
     }
     if !ds_status.unsure.is_empty() {
         info!(



To: SimonSapin, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211213/37ee115e/attachment-0002.html>


More information about the Mercurial-patches mailing list