Bug 1431226 - Reference proper function and allow loading hgrc; r?Build
This fixes a regression in 195e88aab631 (
bug 1429094).
When I reviewed that changeset, I didn't realize there were callers
of the renamed function outside the file.
The other caller (changed in this commit) needs to interact with the
repository. This may require loading extensions. So we can no longer
unconditionally disable the loading of hgrc. We add an argument to
control the loading of hgrc to support this.
MozReview-Commit-ID: 8AkPhvtC1VH
--- a/python/mozboot/mozboot/base.py
+++ b/python/mozboot/mozboot/base.py
@@ -442,29 +442,30 @@ class BaseBootstrapper(object):
stderr=subprocess.STDOUT)
match = re.search(name + ' ([a-z0-9\.]+)', info)
if not match:
print('ERROR! Unable to identify %s version.' % name)
return None
return LooseVersion(match.group(1))
- def _hg_cleanenv(self):
+ def _hg_cleanenv(self, load_hgrc=False):
""" Returns a copy of the current environment updated with the HGPLAIN
and HGRCPATH environment variables.
HGPLAIN prevents Mercurial from applying locale variations to the output
making it suitable for use in scripts.
HGRCPATH controls the loading of hgrc files. Setting it to the empty
string forces that no user or system hgrc file is used.
"""
env = os.environ.copy()
env[b'HGPLAIN'] = b'1'
- env[b'HGRCPATH'] = b''
+ if not load_hgrc:
+ env[b'HGRCPATH'] = b''
return env
def is_mercurial_modern(self):
hg = self.which('hg')
if not hg:
print(NO_MERCURIAL)
return False, False, None
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -315,18 +315,20 @@ class Bootstrapper(object):
high=2)
if choice == 1:
print('Creating global state directory: %s' % state_dir)
os.makedirs(state_dir, mode=0o770)
state_dir_available = os.path.exists(state_dir)
+ # We need to enable the loading of hgrc in case extensions are
+ # required to open the repo.
r = current_firefox_checkout(check_output=self.instance.check_output,
- env=self.instance._hgplain_env(),
+ env=self.instance._hg_cleanenv(load_hgrc=True),
hg=self.instance.which('hg'))
(checkout_type, checkout_root) = r
# Possibly configure Mercurial, but not if the current checkout is Git.
# TODO offer to configure Git.
if hg_installed and state_dir_available and checkout_type != 'git':
configure_hg = False
if not self.instance.no_interactive: