Bug 1191584 - Get the full commit message from a try push in mozharness via pushlog to avoid truncations. r=jlund
authorChris Manchester <cmanchester@mozilla.com>
Thu, 06 Aug 2015 17:53:55 -0700
changeset 288612 09634f89158fea816b3d20107dd57deeb97ff2b1
parent 288611 618c213ed8dbc3af0dd20145b999ae877ba97391
child 288613 56124e9589e18ed152ea6e47c7bd190de9b8f5a1
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlund
bugs1191584
milestone42.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 1191584 - Get the full commit message from a try push in mozharness via pushlog to avoid truncations. r=jlund
testing/mozharness/mozharness/mozilla/testing/testbase.py
testing/mozharness/mozharness/mozilla/testing/try_tools.py
--- a/testing/mozharness/mozharness/mozilla/testing/testbase.py
+++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py
@@ -476,22 +476,17 @@ 2. running via buildbot and running the 
             self.dump_config(file_path=os.path.join(dirs['abs_log_dir'], 'treeconfig.json'),
                              config=self.tree_config)
 
         if (self.buildbot_config and 'properties' in self.buildbot_config and
             self.buildbot_config['properties'].get('branch') == 'try'):
             try_config_path = os.path.join(test_install_dir, 'config', 'mozharness',
                                            'try_arguments.py')
             known_try_arguments = parse_config_file(try_config_path)
-            comments = self.buildbot_config['sourcestamp']['changes'][-1]['comments']
-            if not comments and 'try_syntax' in self.buildbot_config['properties']:
-                # If we don't find try syntax in the usual place, check for it in an
-                # alternate property available to tools using self-serve.
-                comments = self.buildbot_config['properties']['try_syntax']
-            self.parse_extra_try_arguments(comments, known_try_arguments)
+            self.set_extra_try_arguments(known_try_arguments)
 
         self.tree_config.lock()
 
     def structured_output(self, suite_category):
         """Defines whether structured logging is in use in this configuration. This
         may need to be replaced with data from a different config at the resolution
         of bug 1070041 and related bugs.
         """
--- a/testing/mozharness/mozharness/mozilla/testing/try_tools.py
+++ b/testing/mozharness/mozharness/mozilla/testing/try_tools.py
@@ -4,30 +4,58 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 # ***** END LICENSE BLOCK *****
 
 import argparse
 import os
 import re
 
+from mozharness.base.transfer import TransferMixin
 
-class TryToolsMixin(object):
+
+class TryToolsMixin(TransferMixin):
     """Utility functions for an interface between try syntax and out test harnesses.
     Requires log and script mixins."""
 
     harness_extra_args = None
     try_test_paths = []
 
-    def parse_extra_try_arguments(self, msg, known_try_arguments):
-        """Given a commit message, parse to extract additional arguments to pass
-        on to the test harness command line.
+    def _extract_try_message(self):
+        msg = self.buildbot_config['sourcestamp']['changes'][-1]['comments']
+        if len(msg) == 1024:
+            # This commit message was potentially truncated, get the full message
+            # from hg.
+            props = self.buildbot_config['properties']
+            rev = props['revision']
+            repo = props['repo_path']
+            url = 'https://hg.mozilla.org/%s/json-pushes?changeset=%s&full=1' % (repo, rev)
+
+            pushinfo = self.load_json_from_url(url)
+            for k, v in pushinfo.items():
+                if isinstance(v, dict) and 'changesets' in v:
+                    msg = v['changesets'][-1]['desc']
+
+        if not msg and 'try_syntax' in self.buildbot_config['properties']:
+            # If we don't find try syntax in the usual place, check for it in an
+            # alternate property available to tools using self-serve.
+            msg = self.buildbot_config['properties']['try_syntax']
+
+        return msg
+
+    def set_extra_try_arguments(self, known_try_arguments):
+        """Finds a commit message and parses it for extra arguments to pass to the test
+        harness command line and test paths used to filter manifests.
 
         Extracting arguments from a commit message taken directly from the try_parser.
         """
+        msg = self._extract_try_message()
+        if not msg:
+            return
+
         all_try_args = None
         for line in msg.splitlines():
             if 'try: ' in line:
                 # Autoland adds quotes to try strings that will confuse our
                 # args later on.
                 if line.startswith('"') and line.endswith('"'):
                     line = line[1:-1]
                 # Allow spaces inside of [filter expressions]