diff options
| author | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-11 15:56:22 +0900 |
|---|---|---|
| committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-11 16:54:59 +0900 |
| commit | c1467413c90b4fd9c0b67c668906e086af3f6552 (patch) | |
| tree | 9b60a4d5533780b2a6dd105659a86874187e0223 /pygerrit | |
| parent | ea6218a909f89f01819e3070139380ac5583257c (diff) | |
| download | pygerrit-c1467413c90b4fd9c0b67c668906e086af3f6552.tar.gz | |
Fix #8: Support the "topic-changed" stream event
Change-Id: I70b9cbea1da20a1434eea39e3d8e85e94357b792
Diffstat (limited to 'pygerrit')
| -rw-r--r-- | pygerrit/events.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pygerrit/events.py b/pygerrit/events.py index f525320..3774b0c 100644 --- a/pygerrit/events.py +++ b/pygerrit/events.py @@ -301,3 +301,26 @@ class ReviewerAddedEvent(GerritEvent): return u"<ReviewerAddedEvent>: %s %s %s" % (self.change, self.patchset, self.reviewer) + + +@GerritEventFactory.register("topic-changed") +class TopicChangedEvent(GerritEvent): + + """ Gerrit "topic-changed" event. """ + + def __init__(self, json_data): + super(TopicChangedEvent, self).__init__(json_data) + try: + self.change = Change(json_data["change"]) + self.changer = Account(json_data["changer"]) + if "oldTopic" in json_data: + self.oldtopic = json_data["oldTopic"] + else: + self.oldtopic = "" + except KeyError as e: + raise GerritError("TopicChangedEvent: %s" % e) + + def __repr__(self): + return u"<TopicChangedEvent>: %s %s [%s]" % (self.change, + self.changer, + self.oldtopic) |
