Bug 1389417 - Disable problematic extensions when running `hg update`; r?whimboo draft
authorGregory Szorc <gps@mozilla.com>
Fri, 11 Aug 2017 09:18:04 -0700
changeset 644972 74ce84010e4cd08b847283767b519fdebac9b59b
parent 644865 65826179c86e2a3538bcffd969556937e15688cd
child 725766 82937ead8f41c8371db96db44cac273d4554ff04
push id73607
push usergszorc@mozilla.com
push dateFri, 11 Aug 2017 16:18:25 +0000
reviewerswhimboo
bugs1389417
milestone57.0a1
Bug 1389417 - Disable problematic extensions when running `hg update`; r?whimboo We correctly worked around problems for `hg pull` but not for `hg update`. Make the workaround consistent. MozReview-Commit-ID: 7A4dgANO0ip
python/mozboot/mozboot/bootstrap.py
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -348,47 +348,54 @@ def configure_mercurial(hg, root_state_d
         '--config', 'extensions.configwizard=%s/hgext/configwizard' % vct_dir,
         'configwizard',
     ]
     subprocess.call(args)
 
 
 def update_mercurial_repo(hg, url, dest, revision):
     """Perform a clone/pull + update of a Mercurial repository."""
-    args = [hg]
-
     # Disable common extensions whose older versions may cause `hg`
     # invocations to abort.
     disable_exts = [
         'bzexport',
         'bzpost',
         'firefoxtree',
         'hgwatchman',
         'mozext',
         'mqext',
         'qimportbz',
         'push-to-try',
         'reviewboard',
     ]
-    for ext in disable_exts:
-        args.extend(['--config', 'extensions.%s=!' % ext])
+
+    def disable_extensions(args):
+        for ext in disable_exts:
+            args.extend(['--config', 'extensions.%s=!' % ext])
+
+    pull_args = [hg]
+    disable_extensions(pull_args)
 
     if os.path.exists(dest):
-        args.extend(['pull', url])
+        pull_args.extend(['pull', url])
         cwd = dest
     else:
-        args.extend(['clone', '--noupdate', url, dest])
+        pull_args.extend(['clone', '--noupdate', url, dest])
         cwd = '/'
 
+    update_args = [hg]
+    disable_extensions(update_args)
+    update_args.extend(['update', '-r', revision])
+
     print('=' * 80)
     print('Ensuring %s is up to date at %s' % (url, dest))
 
     try:
-        subprocess.check_call(args, cwd=cwd)
-        subprocess.check_call([hg, 'update', '-r', revision], cwd=dest)
+        subprocess.check_call(pull_args, cwd=cwd)
+        subprocess.check_call(update_args, cwd=dest)
     finally:
         print('=' * 80)
 
 
 def clone_firefox(hg, dest):
     """Clone the Firefox repository to a specified destination."""
     print('Cloning Firefox Mercurial repository to %s' % dest)