Patchwork D11758: rhg: $HG_PENDING is not supported

login
register
mail settings
Submitter phabricator
Date Nov. 15, 2021, 5:42 p.m.
Message ID <differential-rev-PHID-DREV-ehwegaoquhagcmcbiz5p-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50083/
State Superseded
Headers show

Comments

phabricator - Nov. 15, 2021, 5:42 p.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Trigger fallback in that case, if configured to do so.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS




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

Patch

diff --git a/tests/test-import.t b/tests/test-import.t
--- a/tests/test-import.t
+++ b/tests/test-import.t
@@ -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
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
@@ -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)
@@ -608,11 +608,21 @@ 
     if unsupported.is_empty() {
         Ok(())
     } else {
-        Err(CommandError::UnsupportedFeature {
-            message: format_bytes!(
-                b"extensions: {} (consider adding them to 'rhg.ignored-extensions' config)",
-                join(unsupported, b", ")
-            ),
-        })
+        Err(CommandError::UnsupportedFeature { message: format_bytes!(
+            b"extensions: {} (consider adding them to 'rhg.ignored-extensions' config)",
+            join(unsupported, b", ")
+        )})
     }
 }
+
+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(())
+}