[Updated] D11940: rhg: Sub-repositories are not supported

SimonSapin phabricator at mercurial-scm.org
Mon Dec 20 13:34:58 UTC 2021


Closed by commit rHG7f633432ca92: rhg: Sub-repositories are not supported (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/D11940?vs=31536&id=31553

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

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

AFFECTED FILES
  rust/hg-core/src/repo.rs
  rust/rhg/src/main.rs
  tests/test-subrepo-deep-nested-change.t
  tests/test-subrepo-missing.t

CHANGE DETAILS

diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t
--- a/tests/test-subrepo-missing.t
+++ b/tests/test-subrepo-missing.t
@@ -1,7 +1,3 @@
-TODO: fix rhg bugs that make this test fail when status is enabled
-  $ unset RHG_STATUS
-
-
   $ hg init repo
   $ cd repo
   $ hg init subrepo
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -1,7 +1,3 @@
-TODO: fix rhg bugs that make this test fail when status is enabled
-  $ unset RHG_STATUS
-
-
   $ cat >> $HGRCPATH <<EOF
   > [extdiff]
   > # for portability:
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
@@ -29,7 +29,7 @@
     repo: Result<&Repo, &NoRepoInCwdError>,
     config: &Config,
 ) -> Result<(), CommandError> {
-    check_unsupported(config, ui)?;
+    check_unsupported(config, repo, ui)?;
 
     let app = App::new("rhg")
         .global_setting(AppSettings::AllowInvalidUtf8)
@@ -643,6 +643,7 @@
 
 fn check_unsupported(
     config: &Config,
+    repo: Result<&Repo, &NoRepoInCwdError>,
     ui: &ui::Ui,
 ) -> Result<(), CommandError> {
     check_extensions(config)?;
@@ -653,6 +654,12 @@
         Err(CommandError::unsupported("$HG_PENDING"))?
     }
 
+    if let Ok(repo) = repo {
+        if repo.has_subrepos()? {
+            Err(CommandError::unsupported("sub-repositories"))?
+        }
+    }
+
     if config.has_non_empty_section(b"encode") {
         Err(CommandError::unsupported("[encode] config"))?
     }
diff --git a/rust/hg-core/src/repo.rs b/rust/hg-core/src/repo.rs
--- a/rust/hg-core/src/repo.rs
+++ b/rust/hg-core/src/repo.rs
@@ -417,6 +417,14 @@
         )
     }
 
+    pub fn has_subrepos(&self) -> Result<bool, DirstateError> {
+        if let Some(entry) = self.dirstate_map()?.get(HgPath::new(".hgsub"))? {
+            Ok(entry.state().is_tracked())
+        } else {
+            Ok(false)
+        }
+    }
+
     pub fn filelog(&self, path: &HgPath) -> Result<Filelog, HgError> {
         Filelog::open(self, path)
     }



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/20211220/627860eb/attachment-0002.html>


More information about the Mercurial-patches mailing list