changeset 48336:5b9865032533

rhg: $HG_PENDING is not supported Trigger fallback in that case, if configured to do so. Differential Revision: https://phab.mercurial-scm.org/D11758
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 09 Nov 2021 17:09:40 +0100
parents b7fde9237c92
children 3bd62274cbc9
files rust/rhg/src/main.rs tests/test-import.t
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/rust/rhg/src/main.rs	Tue Nov 09 19:55:46 2021 +0100
+++ b/rust/rhg/src/main.rs	Tue Nov 09 17:09:40 2021 +0100
@@ -1,4 +1,5 @@
 extern crate log;
+use crate::error::CommandError;
 use crate::ui::Ui;
 use clap::App;
 use clap::AppSettings;
@@ -20,7 +21,6 @@
 pub mod utils {
     pub mod path_utils;
 }
-use error::CommandError;
 
 fn main_with_result(
     process_start_time: &blackbox::ProcessStartTime,
@@ -28,7 +28,7 @@
     repo: Result<&Repo, &NoRepoInCwdError>,
     config: &Config,
 ) -> Result<(), CommandError> {
-    check_extensions(config)?;
+    check_unsupported(config)?;
 
     let app = App::new("rhg")
         .global_setting(AppSettings::AllowInvalidUtf8)
@@ -616,3 +616,15 @@
         })
     }
 }
+
+fn check_unsupported(config: &Config) -> Result<(), CommandError> {
+    check_extensions(config)?;
+
+    if std::env::var_os("HG_PENDING").is_some() {
+        // TODO: only if the value is `== repo.working_directory`?
+        // What about relative v.s. absolute paths?
+        Err(CommandError::unsupported("$HG_PENDING"))?
+    }
+
+    Ok(())
+}
--- a/tests/test-import.t	Tue Nov 09 19:55:46 2021 +0100
+++ b/tests/test-import.t	Tue Nov 09 17:09:40 2021 +0100
@@ -1,7 +1,3 @@
-TODO: fix rhg bugs that make this test fail when status is enabled
-  $ unset RHG_STATUS
-
-
   $ hg init a
   $ mkdir a/d1
   $ mkdir a/d1/d2