Bug 1424386: Update robustcheckout in m-c with latest version from v-c-t r=gps
authorConnor Sheehan <sheehan@mozilla.com>
Wed, 20 Dec 2017 10:48:04 -0500
changeset 448748 62b281c39548aa349fd1141caed5d4340700bbb6
parent 448747 977768c296cadcbc4ca4dda7dc85fca09372712d
child 448749 1fc9f886516a3c96edcedda5d9e17183bebd6f8b
child 448783 7c248344b08bf7bd067fe5761a750374f9fcd236
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1424386
milestone59.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 1424386: Update robustcheckout in m-c with latest version from v-c-t r=gps MozReview-Commit-ID: Lryc4SGlg1y
testing/mozharness/external_tools/robustcheckout.py
--- a/testing/mozharness/external_tools/robustcheckout.py
+++ b/testing/mozharness/external_tools/robustcheckout.py
@@ -32,28 +32,44 @@ from mercurial import (
     cmdutil,
     hg,
     match as matchmod,
     registrar,
     scmutil,
     util,
 )
 
-testedwith = '3.7 3.8 3.9 4.0 4.1 4.2 4.3'
+# TRACKING hg43
+try:
+    from mercurial import configitems
+except ImportError:
+    configitems = None
+
+testedwith = '3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4'
 minimumhgversion = '3.7'
 
 cmdtable = {}
 
-# Mercurial 4.3 introduced registrar.command as a replacement for
+# TRACKING hg43 Mercurial 4.3 introduced registrar.command as a replacement for
 # cmdutil.command.
 if util.safehasattr(registrar, 'command'):
     command = registrar.command(cmdtable)
 else:
     command = cmdutil.command(cmdtable)
 
+# TRACKING hg43 Mercurial 4.3 introduced the config registrar. 4.4 requires
+# config items to be registered to avoid a devel warning
+if util.safehasattr(registrar, 'configitem'):
+    configtable = {}
+    configitem = registrar.configitem(configtable)
+
+    configitem('robustcheckout', 'retryjittermin', default=configitems.dynamicdefault)
+    configitem('robustcheckout', 'retryjittermax', default=configitems.dynamicdefault)
+
+
 # Mercurial 4.2 introduced the vfs module and deprecated the symbol in
 # scmutil.
 def getvfs():
     try:
         from mercurial.vfs import vfs
         return vfs
     except ImportError:
         return scmutil.vfs
@@ -201,19 +217,19 @@ def robustcheckout(ui, url, dest, upstre
 
     # Sparse profile support was added in Mercurial 4.3, where it was highly
     # experimental. Because of the fragility of it, we only support sparse
     # profiles on 4.3. When 4.4 is released, we'll need to opt in to sparse
     # support. We /could/ silently fall back to non-sparse when not supported.
     # However, given that sparse has performance implications, we want to fail
     # fast if we can't satisfy the desired checkout request.
     if sparseprofile:
-        if util.versiontuple(n=2) != (4, 3):
+        if util.versiontuple(n=2) not in ((4, 3), (4, 4)):
             raise error.Abort('sparse profile support only available for '
-                              'Mercurial 4.3 (using %s)' % util.version())
+                              'Mercurial versions greater than 4.3 (using %s)' % util.version())
 
         try:
             extensions.find('sparse')
         except KeyError:
             raise error.Abort('sparse extension must be enabled to use '
                               '--sparseprofile')
 
     ui.warn('(using Mercurial %s)\n' % util.version())
@@ -540,17 +556,17 @@ def _docheckout(ui, url, dest, upstream,
         purgeext = extensions.find('purge')
 
         # Mercurial 4.3 doesn't purge files outside the sparse checkout.
         # See https://bz.mercurial-scm.org/show_bug.cgi?id=5626. Force
         # purging by monkeypatching the sparse matcher.
         try:
             old_sparse_fn = getattr(repo.dirstate, '_sparsematchfn', None)
             if old_sparse_fn is not None:
-                assert util.versiontuple(n=2) == (4, 3)
+                assert util.versiontuple(n=2) in ((4, 3), (4, 4))
                 repo.dirstate._sparsematchfn = lambda: matchmod.always(repo.root, '')
 
             if purgeext.purge(ui, repo, all=True, abort_on_err=True,
                               # The function expects all arguments to be
                               # defined.
                               **{'print': None, 'print0': None, 'dirs': None,
                                  'files': None}):
                 raise error.Abort('error purging')