rhg: add support for ignoring all extensions
authorRaphaël Gomès <rgomes@octobus.net>
Fri, 18 Mar 2022 17:39:06 +0100
changeset 48972 6b31c0676147
parent 48971 4057563ebc6b
child 48978 c80544aa4971
rhg: add support for ignoring all extensions Some workflows just want what `rhg` does and don't care about any extensions, this makes it easier. Differential Revision: https://phab.mercurial-scm.org/D12385
rust/rhg/src/main.rs
tests/test-rhg.t
--- a/rust/rhg/src/main.rs	Thu Mar 17 12:27:40 2022 +0100
+++ b/rust/rhg/src/main.rs	Fri Mar 18 17:39:06 2022 +0100
@@ -643,6 +643,11 @@
     &[b"blackbox", b"share", b"sparse", b"narrow", b"*"];
 
 fn check_extensions(config: &Config) -> Result<(), CommandError> {
+    if let Some(b"*") = config.get(b"rhg", b"ignored-extensions") {
+        // All extensions are to be ignored, nothing to do here
+        return Ok(());
+    }
+
     let enabled: HashSet<&[u8]> = config
         .get_section_keys(b"extensions")
         .into_iter()
--- a/tests/test-rhg.t	Thu Mar 17 12:27:40 2022 +0100
+++ b/tests/test-rhg.t	Fri Mar 18 17:39:06 2022 +0100
@@ -391,3 +391,17 @@
   $ echo "*:required = yes" >> $HGRCPATH
   $ rhg files
   a
+
+We can ignore all extensions at once
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "thisextensionbetternotexist=" >> $HGRCPATH
+  $ echo "thisextensionbetternotexisteither=" >> $HGRCPATH
+  $ $NO_FALLBACK rhg files
+  unsupported feature: extensions: thisextensionbetternotexist, thisextensionbetternotexisteither (consider adding them to 'rhg.ignored-extensions' config)
+  [252]
+
+  $ echo "[rhg]" >> $HGRCPATH
+  $ echo "ignored-extensions=*" >> $HGRCPATH
+  $ $NO_FALLBACK rhg files
+  a