Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pulsebot/pulse_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def add_changeset(self, cs):
'desc': cs['desc'],
'is_backout': bool(BACKOUT_RE.match(cs['desc'])),
})
if cs.get('branch'):
self.changesets[-1]['branch'] = cs['branch']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically speaking, a push could have multiple changesets all on different branches. So the branch should be attached to all changesets. Then when creating the bugzilla message, some kind of per branch aggregation should occur.

So a bugzilla message could look like:

Pushed by foo@bar.com on the branch foo:
https://server/repo/rev/6e4e7985aba3
Foo
https://server/repoa/rev/1234567890ab
Bar

Pushed by foo@bar.com on the branch qux:
https://server/repoa/rev/234567890abc
Qux

Or some other variation where branches are not repeated. Typical pushes would only have something like the first half.


def __iter__(self):
return iter(self.changesets)
Expand Down Expand Up @@ -185,7 +187,8 @@ def munge_for_bugzilla(push):

@staticmethod
def bugzilla_summary(cs):
yield cs['revlink']
yield '%s [%s]' % (cs['revlink'], cs['branch']) if cs.get('branch') \
else cs['revlink']

desc = cs['desc']
matches = [m for m in BUG_RE.finditer(desc)
Expand Down Expand Up @@ -616,6 +619,16 @@ def do_push(push, leave_open=False):
do_push(push)
self.assertEquals(bz.data, {})

bz.clear()
push['changesets'] = self.CHANGESETS[8:9]
comments = {46: [
'Pushed by foo@bar.com:\n'
'https://server/repo/rev/6e4e7985aba3 [subproject]\n'
'Add tags'
]}
do_push(push)
self.assertEquals(bz.comments, comments)

def test_bugzilla_summary(self):
def summary_equals(desc, summary):
self.assertEquals(list(PulseDispatcher.bugzilla_summary({
Expand Down