Patchwork D11403: rhg: fall back if subrepos are detected

login
register
mail settings
Submitter phabricator
Date Sept. 13, 2021, 3:39 p.m.
Message ID <differential-rev-PHID-DREV-3hzwiie35f2j73e55wq2-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49737/
State Superseded
Headers show

Comments

phabricator - Sept. 13, 2021, 3:39 p.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We do not handle subrepos yet, the addition of the support for `-r .` will
  break if we don't fall back.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/rhg/src/main.rs
  tests/test-rhg.t

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-rhg.t b/tests/test-rhg.t
--- a/tests/test-rhg.t
+++ b/tests/test-rhg.t
@@ -367,3 +367,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
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
@@ -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);