Bug 1390239 - Accommodate any ordering of "last" revset in artifact builds. draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 14 Aug 2017 12:21:43 -0700
changeset 646059 fdb58fdef8a470a2456030b0373cf897e16e1bef
parent 645833 df9beb781895fcd0493c21e95ad313e0044515ec
child 726118 549709a7cd185250bb572e5def7eabc136f6892e
push id73983
push usercmanchester@mozilla.com
push dateMon, 14 Aug 2017 19:23:09 +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 reversed(sorted(last_revs))]
 
     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(),