Bug 1390239 - Accommodate any ordering of "last" revset in artifact builds. draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 14 Aug 2017 13:02:41 -0700
changeset 646073 9f81851d28fe6815dacb7ed438220c1561ce72c9
parent 645833 df9beb781895fcd0493c21e95ad313e0044515ec
child 726125 d95f29613f5d665def5ffcfd697e1b9a7dbd948f
push id73990
push usercmanchester@mozilla.com
push dateMon, 14 Aug 2017 20:03:04 +0000
bugs1390239
milestone57.0a1
Bug 1390239 - Accommodate any ordering of "last" revset in artifact builds. A recent mercurial update changed the order of revisions returned by the "last" revset. The expected revisions are still output, so the artifact code is updated in this change to impose its own order based on the local revision order to accommodate any output order. MozReview-Commit-ID: 7Zka0kQtxJO
python/mozbuild/mozbuild/artifacts.py
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -971,22 +971,25 @@ class Artifacts(object):
         """Returns recent ancestors of the working parent that are likely to
         to be known to Mozilla automation.
 
         If we're using git, retrieves hg revisions from git-cinnabar.
         """
         if self._git:
             return self._get_hg_revisions_from_git()
 
-        return subprocess.check_output([
+        # 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', '{node}\n',
+            '--template', '{rev}:{node}\n',
             '-r', 'last(public() and ::., {num})'.format(
                 num=NUM_REVISIONS_TO_QUERY)
         ], cwd=self._topsrcdir).splitlines()
+        return [i.split(':')[-1] for i in sorted(last_revs, reverse=True)]
 
     def _find_pushheads(self):
         """Returns an iterator of recent pushhead revisions, starting with the
         working parent.
         """
 
         last_revs = self._get_recent_public_revisions()
         candidate_pushheads = self._pushheads_from_rev(last_revs[0].rstrip(),