diff --git a/git_cl.py b/git_cl.py index ff391a236..60230cb19 100755 --- a/git_cl.py +++ b/git_cl.py @@ -102,7 +102,6 @@ TRACES_README_FORMAT = ( 'Execution time: %(execution_time)s\n' 'Exit code: %(exit_code)s\n') + TRACES_MESSAGE -COMMIT_BOT_EMAIL = 'commit-bot@chromium.org' POSTUPSTREAM_HOOK = '.git/hooks/post-cl-land' DESCRIPTION_BACKUP_FILE = '.git_cl_description_backup' REFS_THAT_ALIAS_TO_OTHER_REFS = { @@ -1799,13 +1798,12 @@ class Changelist(object): owner = data['owner'].get('_account_id') messages = sorted(data.get('messages', []), key=lambda m: m.get('date')) - last_message_author = messages.pop().get('author', {}) - while last_message_author: - if last_message_author.get('email') == COMMIT_BOT_EMAIL: + while messages: + m = messages.pop() + if m.get('tag', '').startswith('autogenerated:cq:'): # Ignore replies from CQ. - last_message_author = messages.pop().get('author', {}) continue - if last_message_author.get('_account_id') == owner: + if m.get('author', {}).get('_account_id') == owner: # Most recent message was by owner. return 'waiting' else: diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 435e57dd9..85ab7243b 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -2462,8 +2462,8 @@ class TestGitCl(unittest.TestCase): u'_revision_number': 1, u'author': { u'_account_id': 1111084, - u'email': u'commit-bot@chromium.org', - u'name': u'Commit Bot' + u'email': u'could-be-anything@example.com', + u'name': u'LUCI CQ' }, u'date': u'2017-03-15 20:08:45.000000000', u'id': u'f5a6c25ecbd3b3b54a43ae418ed97eff046dc50b',