Merge "Add branch to all the remaining event messages"

This commit is contained in:
Zuul 2021-07-28 16:54:09 +00:00 committed by Gerrit Code Review
commit 3497425ff4
2 changed files with 12 additions and 7 deletions

View File

@ -251,8 +251,9 @@ class Gerrit(threading.Thread):
def comment_added(self, channel, data):
if channel in self._channels_for('events', 'x-all-comments'):
msg = 'A comment has been added to %s: %s %s' % (
msg = 'A comment has been added to %s %s: %s %s' % (
data['change']['project'],
data['change']['branch'],
data['change']['subject'],
data['change']['url'])
self.log.info('Compiled Message %s: %s' % (channel, msg))
@ -262,8 +263,9 @@ class Gerrit(threading.Thread):
if (approval['type'] == 'Verified' and approval['value'] == '-2'
and channel in self._channels_for('events',
'x-vrif-minus-2')):
msg = 'Verification of a change to %s failed: %s %s' % (
msg = 'Verification of a change to %s %s failed: %s %s' % (
data['change']['project'],
data['change']['branch'],
data['change']['subject'],
data['change']['url'])
self.log.info('Compiled Message %s: %s' % (channel, msg))
@ -272,8 +274,9 @@ class Gerrit(threading.Thread):
if (approval['type'] == 'Verified' and approval['value'] == '2'
and channel in self._channels_for('events',
'x-vrif-plus-2')):
msg = 'Verification of a change to %s succeeded: %s %s' % (
msg = 'Verification of a change to %s %s succeeded: %s %s' % (
data['change']['project'],
data['change']['branch'],
data['change']['subject'],
data['change']['url'])
self.log.info('Compiled Message %s: %s' % (channel, msg))
@ -282,8 +285,9 @@ class Gerrit(threading.Thread):
if (approval['type'] == 'Code-Review' and approval['value'] == '-2'
and channel in self._channels_for('events',
'x-crvw-minus-2')):
msg = 'A change to %s has been rejected: %s %s' % (
msg = 'A change to %s %s has been rejected: %s %s' % (
data['change']['project'],
data['change']['branch'],
data['change']['subject'],
data['change']['url'])
self.log.info('Compiled Message %s: %s' % (channel, msg))
@ -292,8 +296,9 @@ class Gerrit(threading.Thread):
if (approval['type'] == 'Code-Review' and approval['value'] == '2'
and channel in self._channels_for('events',
'x-crvw-plus-2')):
msg = 'A change to %s has been approved: %s %s' % (
msg = 'A change to %s %s has been approved: %s %s' % (
data['change']['project'],
data['change']['branch'],
data['change']['subject'],
data['change']['url'])
self.log.info('Compiled Message %s: %s' % (channel, msg))

View File

@ -195,7 +195,7 @@ class GerritTestCase(testtools.TestCase):
self.assertEqual(self.channel, message.channel)
self.assertEqual(
'A comment has been added to '
'openstack/gerritbot: More unit tests '
'openstack/gerritbot master: More unit tests '
'https://review.openstack.org/123456',
message.msg)
@ -215,7 +215,7 @@ class GerritTestCase(testtools.TestCase):
message = self.ircbot.messages[1]
self.assertEqual(self.channel, message.channel)
self.assertEqual(
'Verification of a change to openstack/gerritbot failed: '
'Verification of a change to openstack/gerritbot master failed: '
'More unit tests https://review.openstack.org/123456',
message.msg)