Bug 1225599 - Pull Mercurial repos with common 3rd party extensions disabled; r=dminor

Running old extensions with newer versions of Mercurial may crash `hg`
due to the old extension accessing something or doing something that has
been changed in the new release.

To minimize the risk of this happening, we disable common 3rd party
extensions when cloning or pulling as part of `mach mercurial-setup`. We
don't want to disable everything because some extensions (like
remotenames) provide features the user may want enabled as part of the
clone/update. This leaves the door open for more failures. Hopefully
this approach is sufficient. We can always revisit later.
This commit is contained in:
Gregory Szorc 2015-12-15 10:47:33 -08:00
parent 7b76f4af82
commit 7cace466fc
2 changed files with 22 additions and 2 deletions

View File

@ -10,11 +10,13 @@ import subprocess
# The logic here is far from robust. Improvements are welcome.
def update_mercurial_repo(hg, repo, path, revision='default',
hostfingerprints=None):
hostfingerprints=None, global_args=None):
"""Ensure a HG repository exists at a path and is up to date."""
hostfingerprints = hostfingerprints or {}
args = [hg]
if global_args:
args.extend(global_args)
for host, fingerprint in sorted(hostfingerprints.items()):
args.extend(['--config', 'hostfingerprints.%s=%s' % (host,

View File

@ -46,11 +46,29 @@ class MercurialUpdater(object):
return 0
def update_mercurial_repo(self, hg, url, dest, branch, msg):
# Disable common extensions whose older versions may cause `hg`
# invocations to abort.
disable_exts = [
'bzexport',
'bzpost',
'firefoxtree',
'hgwatchman',
'mqext',
'qimportbz',
'push-to-try',
'reviewboard',
]
global_args = []
for ext in disable_exts:
global_args.extend(['--config', 'extensions.%s=!' % ext])
# 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)
update_mercurial_repo,
hostfingerprints=HOST_FINGERPRINTS,
global_args=global_args)
def _update_repo(self, binary, url, dest, branch, msg, fn, *args, **kwargs):
print('=' * 80)