From ee27b8ebce96f87c0f6c652c177404584c6ac914 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Tue, 15 Dec 2015 10:47:33 -0800 Subject: [PATCH] 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. --HG-- extra : rebase_source : 92e7d8fe227f29fc64c0f69021bd731ba762faf3 --- .../mozversioncontrol/repoupdate.py | 4 +++- tools/mercurial/hgsetup/update.py | 20 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/python/mozversioncontrol/mozversioncontrol/repoupdate.py b/python/mozversioncontrol/mozversioncontrol/repoupdate.py index 604db4b6672c..08be73a344d6 100644 --- a/python/mozversioncontrol/mozversioncontrol/repoupdate.py +++ b/python/mozversioncontrol/mozversioncontrol/repoupdate.py @@ -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, diff --git a/tools/mercurial/hgsetup/update.py b/tools/mercurial/hgsetup/update.py index 916d1a75965e..9bf98ab85537 100644 --- a/tools/mercurial/hgsetup/update.py +++ b/tools/mercurial/hgsetup/update.py @@ -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)