Patchwork D10139: rhg: Add support for the HGRCSKIPREPO environment variable

login
register
mail settings
Submitter phabricator
Date March 9, 2021, 9:42 a.m.
Message ID <differential-rev-PHID-DREV-g7t3busncexiqhxnxby3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48452/
State Superseded
Headers show

Comments

phabricator - March 9, 2021, 9:42 a.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/config/config.rs
  rust/hg-core/src/repo.rs

CHANGE DETAILS




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

Patch

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
@@ -169,7 +169,11 @@ 
             reqs.extend(requirements::load(Vfs { base: &store_path })?);
         }
 
-        let repo_config = config.combine_with_repo(&repo_config_files)?;
+        let repo_config = if std::env::var_os("HGRCSKIPREPO").is_none() {
+            config.combine_with_repo(&repo_config_files)?
+        } else {
+            config.clone()
+        };
 
         let repo = Self {
             requirements: reqs,
diff --git a/rust/hg-core/src/config/config.rs b/rust/hg-core/src/config/config.rs
--- a/rust/hg-core/src/config/config.rs
+++ b/rust/hg-core/src/config/config.rs
@@ -23,6 +23,7 @@ 
 
 /// Holds the config values for the current repository
 /// TODO update this docstring once we support more sources
+#[derive(Clone)]
 pub struct Config {
     layers: Vec<layer::ConfigLayer>,
 }