Bug 1484243 - Detect vcs automatically in |mach vcs-setup|. r=ahal
authorPanos Astithas <past@mozilla.com>
Wed, 22 Aug 2018 17:26:58 +0000
changeset 487976 120c4145368ddf63e4837f136244e87f6b75c8a8
parent 487975 eab9b539b249646a7c4f9f6384e834dfdba4af9a
child 488023 f8d52bf9ffdedf8d9197690ee848c3d88f360b53
child 488025 65db8f04be61b91b4eb13acd4f1b383a2f0f051e
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1484243
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1484243 - Detect vcs automatically in |mach vcs-setup|. r=ahal Differential Revision: https://phabricator.services.mozilla.com/D3942
python/mozboot/mozboot/mach_commands.py
--- a/python/mozboot/mozboot/mach_commands.py
+++ b/python/mozboot/mozboot/mach_commands.py
@@ -42,54 +42,51 @@ class Bootstrap(object):
 class VersionControlCommands(object):
     def __init__(self, context):
         self._context = context
 
     @Command('vcs-setup', category='devenv',
              description='Help configure a VCS for optimal development.')
     @CommandArgument('-u', '--update-only', action='store_true',
                      help='Only update recommended extensions, don\'t run the wizard.')
-    @CommandArgument('-g', '--git', action='store_true',
-                     help='Use Git instead of Mercurial.')
-    def vcs_setup(self, update_only=False, git=False):
+    def vcs_setup(self, update_only=False):
         """Ensure a Version Control System (Mercurial or Git) is optimally
         configured.
 
         This command will inspect your VCS configuration and
-        guide you through an interactive wizard helping you configure
+        guide you through an interactive wizard helping you configure the
         VCS for optimal use on Mozilla projects.
 
         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
         VCS extensions are up to date.
-
-        If "--git" is used, then Git is selected as the VCS instead of Mercurial,
-        which is the default.
         """
         import which
         import mozboot.bootstrap as bootstrap
+        import mozversioncontrol
 
+        repo = mozversioncontrol.get_repository_object(self._context.topdir)
         vcs = 'hg'
-        if git:
+        if repo.name == 'git':
             vcs = 'git'
 
         # "hg" is an executable script with a shebang, which will be found
         # by which.which. We need to pass a win32 executable to the function
         # because we spawn a process
         # from it.
         if sys.platform in ('win32', 'msys'):
             vcs = which.which(vcs + '.exe')
         else:
             vcs = which.which(vcs)
 
         if update_only:
-            if git:
+            if repo.name == 'git':
                 bootstrap.update_git_tools(vcs, self._context.state_dir)
             else:
                 bootstrap.update_vct(vcs, self._context.state_dir)
         else:
-            if git:
+            if repo.name == 'git':
                 bootstrap.configure_git(vcs, self._context.state_dir)
             else:
                 bootstrap.configure_mercurial(vcs, self._context.state_dir)