Bug 1662632 - Fix `UnboundLocalError` due to undefined variable `have_clone` in `mach bootstrap` r=froydnj

This consolidates the `have_clone` logic in one place unconditionally. After bug 1647792 we're deprecating the use case where `bootstrap` is run without a clone, so that's not a problem.

In reality the whole `have_clone` thing isn't necessary any more (`have_clone` is always going to be `True` in practice), but I'll save that for a bigger refactoring.

Differential Revision: https://phabricator.services.mozilla.com/D89152
This commit is contained in:
Ricky Stewart 2020-09-02 14:57:22 +00:00
Родитель 5db1fd1dd5
Коммит 6d5c9de81b
1 изменённых файлов: 12 добавлений и 20 удалений

Просмотреть файл

@ -402,17 +402,19 @@ class Bootstrapper(object):
# as possible if this check fails.
self.instance.ensure_python_modern()
if self.instance.no_system_changes:
state_dir_available, state_dir = self.try_to_create_state_dir()
# We need to enable the loading of hgrc in case extensions are
# required to open the repo.
r = current_firefox_checkout(
env=self.instance._hg_cleanenv(load_hgrc=True),
hg=self.instance.which('hg'))
(checkout_type, checkout_root) = r
self.instance.validate_environment(checkout_root)
have_clone = bool(checkout_type)
state_dir_available, state_dir = self.try_to_create_state_dir()
if state_dir_available:
self.instance.state_dir = state_dir
# We need to enable the loading of hgrc in case extensions are
# required to open the repo.
(checkout_type, checkout_root) = current_firefox_checkout(
env=self.instance._hg_cleanenv(load_hgrc=True),
hg=self.instance.which('hg'))
self.instance.validate_environment(checkout_root)
have_clone = bool(checkout_type)
if self.instance.no_system_changes:
if state_dir_available:
self.check_telemetry_opt_in(state_dir)
self.maybe_install_private_packages_or_exit(state_dir,
@ -432,16 +434,6 @@ class Bootstrapper(object):
if not self.instance.artifact_mode:
self.instance.ensure_rust_modern()
state_dir_available, state_dir = self.try_to_create_state_dir()
# We need to enable the loading of hgrc in case extensions are
# required to open the repo.
r = current_firefox_checkout(env=self.instance._hg_cleanenv(load_hgrc=True),
hg=self.instance.which('hg'))
(checkout_type, checkout_root) = r
self.instance.validate_environment(checkout_root)
# If we didn't specify a VCS, and we aren't in an exiting clone,
# offer a choice
if not self.vcs: