Commit 8aa9d62e authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by LUCI CQ

git cl: better detection of messages from CQ.

CQ added support to project-scoped accounts instead of previously
hardcoded commit-bot@ for working with Gerrit.

R=ehmaldonado

Test: `git cl status` on this very CL :)
Bug: 911811
Change-Id: I8f48a7bdc9dad9a5b71d266ccf7e9a493aa94aa9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2095986Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
parent f8ceb227
......@@ -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:
......
......@@ -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',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment