Bug 1277406 - Use the bootstrapper code for `mach mercurial-setup`; r=glandium draft
authorGregory Szorc <gps@mozilla.com>
Thu, 09 Jun 2016 13:19:04 -0700
changeset 377537 56697d504ff41ad02d77ddd1241cebafe610751a
parent 377536 c727017bbdc703399fa67e1d831280441026614b
child 377538 6c1e2363793fe2cd3a506ce5d962788657871203
push id20819
push userbmo:gps@mozilla.com
push dateFri, 10 Jun 2016 16:14:00 +0000
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
--- a/python/mozboot/mozboot/mach_commands.py
+++ b/python/mozboot/mozboot/mach_commands.py
@@ -1,17 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this,
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 from __future__ import absolute_import, print_function, unicode_literals
-import os
-import sys
 from mach.decorators import (
@@ -45,27 +42,17 @@ class VersionControlCommands(object):
         User choice is respected: no changes are made without explicit
         confirmation from you.
         If "--update-only" is used, the interactive wizard is disabled
         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)
-            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)