changeset 49539:8076298b795a stable

rhg: fallback to slow path on invalid patterns in hgignore
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Mon, 31 Oct 2022 16:15:54 +0000
parents b51e5c2ab5fd
children bc2ecf08ae04
files rust/rhg/src/error.rs tests/test-hgignore.t
diffstat 2 files changed, 9 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/rust/rhg/src/error.rs	Mon Oct 31 16:15:30 2022 +0000
+++ b/rust/rhg/src/error.rs	Mon Oct 31 16:15:54 2022 +0000
@@ -221,7 +221,12 @@
 
 impl From<StatusError> for CommandError {
     fn from(error: StatusError) -> Self {
-        CommandError::abort(format!("{}", error))
+        match error {
+            StatusError::Pattern(_) => {
+                CommandError::unsupported(format!("{}", error))
+            }
+            _ => CommandError::abort(format!("{}", error)),
+        }
     }
 }
 
--- a/tests/test-hgignore.t	Mon Oct 31 16:15:30 2022 +0000
+++ b/tests/test-hgignore.t	Mon Oct 31 16:15:54 2022 +0000
@@ -59,36 +59,24 @@
   ? syntax
 
   $ echo "*.o" > .hgignore
-#if no-rhg
   $ hg status
   abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob)
   [255]
-#endif
-#if rhg
-  $ hg status
-  Unsupported syntax regex parse error:
-      ^(?:*.o)
-          ^
-  error: repetition operator missing expression
-  [255]
-#endif
 
   $ echo 're:^(?!a).*\.o$' > .hgignore
-#if no-rhg
   $ hg status
   A dir/b.o
   ? .hgignore
   ? a.c
   ? a.o
   ? syntax
-#endif
 #if rhg
-  $ hg status
-  Unsupported syntax regex parse error:
+  $ hg status --config rhg.on-unsupported=abort
+  unsupported feature: Unsupported syntax regex parse error:
       ^(?:^(?!a).*\.o$)
            ^^^
   error: look-around, including look-ahead and look-behind, is not supported
-  [255]
+  [252]
 #endif
 
 Ensure given files are relative to cwd