Bug 1505579 - Upgrade to latest robustcheckout; r=sheehan
Vendored robustcheckout extension from the version-control-tools
repository revision d78e5c52a0228c3dc8ed03fe43bf749c8e68bd20 without
modifications.
This is needed to support Mercurial 4.8.
Differential Revision:
https://phabricator.services.mozilla.com/D11398
--- a/testing/mozharness/external_tools/robustcheckout.py
+++ b/testing/mozharness/external_tools/robustcheckout.py
@@ -44,18 +44,18 @@ try:
from mercurial import configitems
configitems.dynamicdefault
except ImportError:
configitems = None
# Causes worker to purge caches on process exit and for task to retry.
EXIT_PURGE_CACHE = 72
-testedwith = '3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7'
-minimumhgversion = '3.7'
+testedwith = '4.3 4.4 4.5 4.6 4.7 4.8'
+minimumhgversion = '4.3'
cmdtable = {}
# TRACKING hg43 Mercurial 4.3 introduced registrar.command as a replacement for
# cmdutil.command.
if util.safehasattr(registrar, 'command'):
command = registrar.command(cmdtable)
else:
@@ -83,23 +83,19 @@ def getvfs():
def getsparse():
from mercurial import sparse
return sparse
def supported_hg():
'''Returns True if the Mercurial version is supported for robustcheckout'''
- return util.versiontuple(n=2) in (
- (4, 3),
- (4, 4),
- (4, 5),
- (4, 6),
- (4, 7),
- )
+ return '.'.join(
+ str(v) for v in util.versiontuple(n=2)
+ ) in testedwith.split()
if os.name == 'nt':
import ctypes
# Get a reference to the DeleteFileW function
# DeleteFileW accepts filenames encoded as a null terminated sequence of
# wide chars (UTF-16). Python's ctypes.c_wchar_p correctly encodes unicode
@@ -675,17 +671,22 @@ def _docheckout(ui, url, dest, upstream,
# By default, Mercurial will ignore unknown sparse profiles. This could
# lead to a full checkout. Be more strict.
try:
repo.filectx(sparse_profile, changeid=checkoutrevision).data()
except error.ManifestLookupError:
raise error.Abort('sparse profile %s does not exist at revision '
'%s' % (sparse_profile, checkoutrevision))
- old_config = sparsemod.parseconfig(repo.ui, repo.vfs.tryread('sparse'))
+ # TRACKING hg48 - parseconfig takes `action` param
+ if util.versiontuple(n=2) >= (4, 8):
+ old_config = sparsemod.parseconfig(repo.ui, repo.vfs.tryread('sparse'), 'sparse')
+ else:
+ old_config = sparsemod.parseconfig(repo.ui, repo.vfs.tryread('sparse'))
+
old_includes, old_excludes, old_profiles = old_config
if old_profiles == {sparse_profile} and not old_includes and not \
old_excludes:
ui.write('(sparse profile %s already set; no need to update '
'sparse config)\n' % sparse_profile)
else:
if old_includes or old_excludes or old_profiles: