Bug 1277406 - Use the bootstrapper code for mach mercurial-setup; r=glandium

The Mercurial setup wizard has now been ported to the version-control-tools
repository, where it has testing and integrates better with Mercurial
configs.

The bootstrapper has been taught how to invoke the new version of the
Mercurial setup wizard.

This commit switched `mach mercurial-setup` to call the bootstrapper
code for invoking the Mercurial setup wizard from version-control-tools.
As of this commit, the Mercurial setup wizard in tools/mercurial is
unused.

MozReview-Commit-ID: 3xzgOYZWTZn

--HG--
extra : rebase_source : 56697d504ff41ad02d77ddd1241cebafe610751a
extra : histedit_source : feb7450130c447dc74e059173f5b54544c020929
This commit is contained in:
Gregory Szorc 2016-06-09 13:19:04 -07:00
parent c67e0b8843
commit 854ef84c06

View File

@ -4,9 +4,6 @@
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
from mach.decorators import (
CommandArgument,
CommandProvider,
@ -50,22 +47,12 @@ class VersionControlCommands(object):
and this command only ensures that remote repositories providing
Mercurial extensions are up to date.
"""
config_paths = ['~/.hgrc']
if sys.platform in ('win32', 'cygwin'):
config_paths.insert(0, '~/mercurial.ini')
config_paths = map(os.path.expanduser, config_paths)
import which
import mozboot.bootstrap as bootstrap
hg = which.which('hg')
if update_only:
from hgsetup.update import MercurialUpdater
updater = MercurialUpdater(self._context.state_dir)
result = updater.update_all()
bootstrap.update_vct(hg, self._context.state_dir)
else:
from hgsetup.wizard import MercurialSetupWizard
wizard = MercurialSetupWizard(self._context.state_dir)
result = wizard.run(map(os.path.expanduser, config_paths))
if result:
print('(despite the failure, mach will not nag you to run '
'`mach mercurial-setup`)')
return result
bootstrap.configure_mercurial(hg, self._context.state_dir)