Bug 1583234 - Set HGPLAIN when running hg during an artifact build. r=nalexander
☠☠ backed out by 06853f21480b ☠ ☠
authorChris Manchester <cmanchester@mozilla.com>
Mon, 30 Sep 2019 20:55:22 +0000
changeset 495665 45f760e2a4c1f56747c6ff79ecd3f7eb59108976
parent 495664 fbc81f84273941e9f7b3ccbcbb5bfe9201d2f6af
child 495666 4d973794f0e03354d5e695326d6e0aed6e2ea67c
push id96769
push usercmanchester@mozilla.com
push dateMon, 30 Sep 2019 20:56:11 +0000
treeherderautoland@45f760e2a4c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1583234
milestone71.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 1583234 - Set HGPLAIN when running hg during an artifact build. r=nalexander Differential Revision: https://phabricator.services.mozilla.com/D47656
python/mozbuild/mozbuild/artifacts.py
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -874,16 +874,23 @@ class Artifacts(object):
             self._cache_dir, log=self._log, skip_cache=self._skip_cache)
         self._pushhead_cache = PushheadCache(
             self._cache_dir, log=self._log, skip_cache=self._skip_cache)
 
     def log(self, *args, **kwargs):
         if self._log:
             self._log(*args, **kwargs)
 
+    def run_hg(self, *args, **kwargs):
+        env = kwargs.get('env', {})
+        env['HGPLAIN'] = '1'
+        kwargs['env'] = env
+        return subprocess.check_output([self._hg] + list(args),
+                                       **kwargs)
+
     def _guess_artifact_job(self):
         # Add the "-debug" suffix to the guessed artifact job name
         # if MOZ_DEBUG is enabled.
         if self._substs.get('MOZ_DEBUG'):
             target_suffix = '-debug'
         elif self._substs.get('MOZ_PGO'):
             target_suffix = '-pgo'
         else:
@@ -980,22 +987,20 @@ class Artifacts(object):
 
         If we're using git, retrieves hg revisions from git-cinnabar.
         """
         if self._git:
             return self._get_hg_revisions_from_git()
 
         # Mercurial updated the ordering of "last" in 4.3. We use revision
         # numbers to order here to accommodate multiple versions of hg.
-        last_revs = subprocess.check_output([
-            self._hg, 'log',
-            '--template', '{rev}:{node}\n',
+        last_revs = self.run_hg('log', '--template', '{rev}:{node}\n',
             '-r', 'last(public() and ::., {num})'.format(
-                num=NUM_REVISIONS_TO_QUERY)
-        ], cwd=self._topsrcdir).splitlines()
+                num=NUM_REVISIONS_TO_QUERY),
+            cwd=self._topsrcdir).splitlines()
 
         if len(last_revs) == 0:
             raise Exception("""\
 There are no public revisions.
 This can happen if the repository is created from bundle file and never pulled
 from remote.  Please run `hg pull` and build again.
 see https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code/Mercurial/Bundles\
 """)
@@ -1172,18 +1177,18 @@ see https://developer.mozilla.org/en-US/
     def install_from_recent(self, distdir):
         hg_pushheads = self._find_pushheads()
         return self._install_from_hg_pushheads(hg_pushheads, distdir)
 
     def install_from_revset(self, revset, distdir):
         revision = None
         try:
             if self._hg:
-                revision = subprocess.check_output([self._hg, 'log', '--template', '{node}\n',
-                                                    '-r', revset], cwd=self._topsrcdir).strip()
+                revision = self.run_hg('log', '--template', '{node}\n', '-r', revset,
+                                       cwd=self._topsrcdir).strip()
             elif self._git:
                 revset = subprocess.check_output([
                     self._git, 'rev-parse', '%s^{commit}' % revset],
                     stderr=open(os.devnull, 'w'), cwd=self._topsrcdir).strip()
             else:
                 # Fallback to the exception handling case from both hg and git
                 raise subprocess.CalledProcessError()
         except subprocess.CalledProcessError: