changeset 48077:ba773bd99203

rhg: fall back if subrepos are detected We do not handle subrepos yet, the addition of the support for `-r .` will break if we don't fall back. Differential Revision: https://phab.mercurial-scm.org/D11403
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 13 Sep 2021 15:12:35 +0200
parents b44e1184b7e1
children ddde80830aea
files rust/rhg/src/main.rs tests/test-rhg.t
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rust/rhg/src/main.rs	Wed Sep 01 18:09:35 2021 +0200
+++ b/rust/rhg/src/main.rs	Mon Sep 13 15:12:35 2021 +0200
@@ -98,6 +98,15 @@
         config,
         repo,
     };
+
+    if let Ok(repo) = repo {
+        // We don't support subrepos, fallback if the subrepos file is present
+        if repo.working_directory_vfs().join(".hgsub").exists() {
+            let msg = "subrepos (.hgsub is present)";
+            return Err(CommandError::unsupported(msg));
+        }
+    }
+
     let blackbox = blackbox::Blackbox::new(&invocation, process_start_time)?;
     blackbox.log_command_start();
     let result = run(&invocation);
--- a/tests/test-rhg.t	Wed Sep 01 18:09:35 2021 +0200
+++ b/tests/test-rhg.t	Mon Sep 13 15:12:35 2021 +0200
@@ -370,3 +370,12 @@
   $ cat .hg/blackbox.log.1
   ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files (glob)
 
+Subrepos are not supported
+
+  $ touch .hgsub
+  $ $NO_FALLBACK rhg files
+  unsupported feature: subrepos (.hgsub is present)
+  [252]
+  $ rhg files
+  a
+  $ rm .hgsub