Bug 1526284 - also show perfherder links for autoland repositories r=sheehan
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 22 Feb 2019 19:02:17 +0000
changeset 6860 2dbca49f704c0593fb645be04a9096514b4ad338
parent 6859 f2bdff4bbf4794cf3d7b9f6d02a6f1c09d619379
child 6861 20814b01e70f97af934e1392b8276aaf0204b8bc
push id3414
push usercosheehan@mozilla.com
push dateFri, 22 Feb 2019 19:03:26 +0000
treeherderversion-control-tools@2dbca49f704c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssheehan
bugs1526284
Bug 1526284 - also show perfherder links for autoland repositories r=sheehan Differential Revision: https://phabricator.services.mozilla.com/D19145
hgext/hgmo/__init__.py
hgext/hgmo/tests/test-treeherder.t
--- a/hgext/hgmo/__init__.py
+++ b/hgext/hgmo/__init__.py
@@ -225,17 +225,19 @@ def addmetadata(repo, ctx, d, onlycheap=
     if treeherder:
         d['treeherderrepourl'] = 'https://treeherder.mozilla.org/#/jobs?repo=%s' % treeherder
         d['treeherderrepo'] = treeherder
 
         push = repo.pushlog.pushfromchangeset(ctx)
         # Don't print Perfherder link on non-publishing repos (like Try)
         # because the previous push likely has nothing to do with this
         # push.
-        if push and push.nodes and repo.ui.configbool('phases', 'publish', True):
+        # Changeset on autoland are in the phase 'draft' until they get merged
+        # to mozilla-central.
+        if push and push.nodes and (repo.ui.configbool('phases', 'publish', True) or treeherder == 'autoland'):
             lastpushhead = repo[push.nodes[0]].hex()
             d['perfherderurl'] = (
                 'https://treeherder.mozilla.org/perf.html#/compare?'
                 'originalProject=%s&'
                 'originalRevision=%s&'
                 'newProject=%s&'
                 'newRevision=%s') % (treeherder, push.nodes[-1],
                                      treeherder, lastpushhead)
--- a/hgext/hgmo/tests/test-treeherder.t
+++ b/hgext/hgmo/tests/test-treeherder.t
@@ -20,16 +20,39 @@
 No Treeherder link unless the repository defines its Treeherder repo
 
   $ http http://localhost:$HGPORT/rev/be788785547b --body-file body > /dev/null
   $ grep '>treeherder' body
   [1]
   $ grep perfherder body
   [1]
 
+No Treeherder link if non-publishing phase and not autoland (e.g. Try)
+
+  $ cat > .hg/hgrc << EOF
+  > [mozilla]
+  > treeherder_repo = try
+  > [phases]
+  > publish = False
+  > EOF
+  $ hg serve -d -p $HGPORT1 --pid-file hg.pid --hgmo -E error-phases-try.log
+  $ grep '>treeherder' body
+  [1]
+
+Treeherder link if non-publishing phase and autoland
+
+  $ cat > .hg/hgrc << EOF
+  > [mozilla]
+  > treeherder_repo = autoland
+  > [phases]
+  > publish = False
+  > EOF
+  $ hg serve -d -p $HGPORT1 --pid-file hg.pid --hgmo -E error-phases-autoland.log
+  <tr><td>treeherder</td><td>autoland@0a37bfb47d98 [<a href="https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=0a37bfb47d9849cceb609070a69c0715a176dd3e">default view</a>] [<a href="https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=0a37bfb47d9849cceb609070a69c0715a176dd3e&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception">failures only]</td></tr>
+
 Configure the Treeherder repo
 
   $ cd server
   $ cat >> .hg/hgrc << EOF
   > [mozilla]
   > treeherder_repo = mozilla-central
   > EOF