Bug 1231192 - Support clonebundles feature; r=smacleod
authorGregory Szorc <gps@mozilla.com>
Mon, 07 Dec 2015 13:03:17 -0800
changeset 276005 6791163296c13a7dc22b776fb08975026bdedeba
parent 276004 f70eb7c9c9f14d8d59dfcf64ff23cf10096e2ce2
child 276006 4b0aa51b8b602b349f149c156d92c0561318bec2
push id29781
push usercbook@mozilla.com
push dateThu, 10 Dec 2015 11:07:51 +0000
treeherdermozilla-central@412e4d7ce98c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1231192 - Support clonebundles feature; r=smacleod bundleclone is the Mozilla-specific precursor to the "clonebundles" feature in Mercurial 3.6. Change the wizard to recognize when clonebundles is available and to favor it. Activating clonebundles will also disable bundleclone, as bundleclone is redundant with clonebundles. (If both are enabled, bundleclone detects this and gets out of the way.)
--- a/tools/mercurial/hgsetup/config.py
+++ b/tools/mercurial/hgsetup/config.py
@@ -204,8 +204,23 @@ class MercurialConfig(object):
     def clear_legacy_bugzilla_credentials(self):
         if 'bugzilla' not in self._c:
         b = self._c['bugzilla']
         for k in ('password', 'userid', 'cookie'):
             if k in b:
                 del b[k]
+    def have_clonebundles(self):
+        return 'clonebundles' in self._c.get('experimental', {})
+    def activate_clonebundles(self):
+        exp = self._c.setdefault('experimental', {})
+        exp['clonebundles'] = 'true'
+        # bundleclone is redundant with clonebundles. Remove it if it
+        # is installed.
+        ext = self._c.get('extensions', {})
+        try:
+            del ext['bundleclone']
+        except KeyError:
+            pass
--- a/tools/mercurial/hgsetup/wizard.py
+++ b/tools/mercurial/hgsetup/wizard.py
@@ -206,16 +206,25 @@ try syntax and pushes it to the try serv
 to be used in concert with other tools generating try syntax so that
 they can push to try without depending on mq or other workarounds.
 (Relevant config option: extensions.push-to-try)
 Would you like to activate push-to-try
+Mercurial 3.6 and hg.mozilla.org support transparently cloning from a CDN,
+making clones faster and more reliable.
+(Relevant config option: experimental.clonebundles)
+Would you like to activate this feature and have faster clones
 The bundleclone extension makes cloning faster and saves server resources.
 We highly recommend you activate this extension.
 (Relevant config option: extensions.bundleclone)
@@ -354,17 +363,23 @@ class MercurialSetupWizard(object):
         self.prompt_external_extension(c, 'bzexport', BZEXPORT_INFO)
         if hg_version >= BZPOST_MINIMUM_VERSION:
             self.prompt_external_extension(c, 'bzpost', BZPOST_INFO)
         if hg_version >= FIREFOXTREE_MINIMUM_VERSION:
             self.prompt_external_extension(c, 'firefoxtree', FIREFOXTREE_INFO)
-        if hg_version >= BUNDLECLONE_MINIMUM_VERSION:
+        # Functionality from bundleclone is experimental in Mercurial 3.6.
+        # There was a bug in 3.6, so look for 3.6.1.
+        if hg_version >= LooseVersion('3.6.1'):
+            if not c.have_clonebundles() and self._prompt_yn(CLONEBUNDLES_INFO):
+                c.activate_clonebundles()
+                print('Enabled the clonebundles feature.\n')
+        elif hg_version >= BUNDLECLONE_MINIMUM_VERSION:
             self.prompt_external_extension(c, 'bundleclone', BUNDLECLONE_INFO)
         if hg_version >= PUSHTOTRY_MINIMUM_VERSION:
             self.prompt_external_extension(c, 'push-to-try', PUSHTOTRY_INFO)
         if 'mq' in c.extensions:
             self.prompt_external_extension(c, 'mqext', MQEXT_INFO)