Bug 1510591 - Fix 'get_changed_files' to cope with empty commit messages. r=dustin
authorJustin Wood <Callek@gmail.com>
Wed, 28 Nov 2018 18:36:04 +0000
changeset 504997 4e1a901cc0a5b0ca50f00cc929a967e0e6c0063e
parent 504996 95ae4f717250683c7f338ab8d8b7f751d1d438c5
child 504998 abbe480903f5043b3507208798ee7c84fcc0f03c
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1510591
milestone65.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 1510591 - Fix 'get_changed_files' to cope with empty commit messages. r=dustin c['desc'].splitlines()[0] raises an error because .splitlines() returns an empty list, rather than a one element list with an empty string when c['desc'] is ''. So test for c['desc'] first and then set it. Differential Revision: https://phabricator.services.mozilla.com/D13252
taskcluster/taskgraph/files_changed.py
--- a/taskcluster/taskgraph/files_changed.py
+++ b/taskcluster/taskgraph/files_changed.py
@@ -32,19 +32,22 @@ def get_changed_files(repository, revisi
         response = requests.get(url, timeout=30)
         return response.json()
     contents = retry(get_automationrelevance, attempts=10, sleeptime=10)
 
     logger.debug('{} commits influencing task scheduling:'
                  .format(len(contents['changesets'])))
     changed_files = set()
     for c in contents['changesets']:
+        desc = ""  # Support empty desc
+        if c['desc']:
+            desc = c['desc'].splitlines()[0].encode('ascii', 'ignore')
         logger.debug(" {cset} {desc}".format(
             cset=c['node'][0:12],
-            desc=c['desc'].splitlines()[0].encode('ascii', 'ignore')))
+            desc=desc))
         changed_files |= set(c['files'])
 
     return changed_files
 
 
 def check(params, file_patterns):
     """Determine whether any of the files changed in the indicated push to
     https://hg.mozilla.org match any of the given file patterns."""