Bug 1197527 - Always clone version-control-tools in MercurialSetupWizard; r=gps
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 24 Aug 2015 10:31:55 -0700
changeset 259085 2a79899cf4f76ff12b3b2c73151b7f953080c209
parent 259084 36786f4a30740917c9e652754a28967bf5d609e1
child 259086 6f0bf5a7187c09a83bd7d64fba1e74a83744eda3
push id29268
push userryanvm@gmail.com
push dateTue, 25 Aug 2015 00:37:23 +0000
treeherdermozilla-central@08015770c9d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1197527
milestone43.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 1197527 - Always clone version-control-tools in MercurialSetupWizard; r=gps
tools/mercurial/hgsetup/update.py
tools/mercurial/hgsetup/wizard.py
--- a/tools/mercurial/hgsetup/update.py
+++ b/tools/mercurial/hgsetup/update.py
@@ -29,24 +29,25 @@ class MercurialUpdater(object):
         try:
             hg = which.which('hg')
         except which.WhichError as e:
             print(e)
             print('Try running |mach bootstrap| to ensure your environment is '
                 'up to date.')
             return 1
 
-        if os.path.isdir(self.vcs_tools_dir):
-            self.update_mercurial_repo(
-                hg,
-                'https://hg.mozilla.org/hgcustom/version-control-tools',
-                self.vcs_tools_dir,
-                'default',
-                'Ensuring version-control-tools is up to date...')
-        print(FINISHED)
+        repo_existed = os.path.isdir(self.vcs_tools_dir)
+        self.update_mercurial_repo(
+            hg,
+            'https://hg.mozilla.org/hgcustom/version-control-tools',
+            self.vcs_tools_dir,
+            'default',
+            'Ensuring version-control-tools is up to date...')
+        if repo_existed:
+            print(FINISHED)
         return 0
 
     def update_mercurial_repo(self, hg, url, dest, branch, msg):
         # We always pass the host fingerprints that we "know" to be canonical
         # because the existing config may have outdated fingerprints and this
         # may cause Mercurial to abort.
         return self._update_repo(hg, url, dest, branch, msg,
             update_mercurial_repo, hostfingerprints=HOST_FINGERPRINTS)
--- a/tools/mercurial/hgsetup/wizard.py
+++ b/tools/mercurial/hgsetup/wizard.py
@@ -231,17 +231,16 @@ class MercurialSetupWizard(object):
     """Command-line wizard to help users configure Mercurial."""
 
     def __init__(self, state_dir):
         # We use normpath since Mercurial expects the hgrc to use native path
         # separators, but state_dir uses unix style paths even on Windows.
         self.state_dir = os.path.normpath(state_dir)
         self.ext_dir = os.path.join(self.state_dir, 'mercurial', 'extensions')
         self.vcs_tools_dir = os.path.join(self.state_dir, 'version-control-tools')
-        self.update_vcs_tools = False
         self.updater = MercurialUpdater(state_dir)
 
     def run(self, config_paths):
         try:
             os.makedirs(self.ext_dir)
         except OSError as e:
             if e.errno != errno.EEXIST:
                 raise
@@ -273,16 +272,18 @@ class MercurialSetupWizard(object):
 
             return 1
         except ParseException as e:
             print('Error importing existing Mercurial config: %s\n' % config_path)
             print('Line %d: %s' % (e.line, e.message))
 
             return 1
 
+        self.updater.update_all()
+
         print(INITIAL_MESSAGE)
         raw_input()
 
         hg_version = get_hg_version(hg)
         if hg_version < OLDEST_NON_LEGACY_VERSION:
             print(LEGACY_MERCURIAL % hg_version)
             print('')
 
@@ -394,24 +395,16 @@ class MercurialSetupWizard(object):
 
             if bzuser and not bzpass:
                 bzpass = self._prompt('What is your Bugzilla password? (optional)',
                     allow_empty=True)
 
             if bzuser or bzpass:
                 c.set_bugzilla_credentials(bzuser, bzpass)
 
-        if self.update_vcs_tools:
-            self.updater.update_mercurial_repo(
-                hg,
-                'https://hg.mozilla.org/hgcustom/version-control-tools',
-                self.vcs_tools_dir,
-                'default',
-                'Ensuring version-control-tools is up to date...')
-
         # Look for and clean up old extensions.
         for ext in {'bzexport', 'qimportbz', 'mqext'}:
             path = os.path.join(self.ext_dir, ext)
             if os.path.exists(path):
                 if self._prompt_yn('Would you like to remove the old and no '
                     'longer referenced repository at %s' % path):
                     print('Cleaning up old repository: %s' % path)
                     shutil.rmtree(path)
@@ -512,17 +505,16 @@ class MercurialSetupWizard(object):
             print(name)
             print('=' * len(name))
             print('')
             if not self._prompt_yn(prompt_text):
                 print('')
                 return
         if not path:
             path = os.path.join(self.vcs_tools_dir, 'hgext', name)
-        self.update_vcs_tools = True
         c.activate_extension(name, path)
         print('Activated %s extension.\n' % name)
 
     def _prompt(self, msg, allow_empty=False):
         print(msg)
 
         while True:
             response = raw_input().decode('utf-8')