diff options
| author | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-13 19:03:24 +0900 |
|---|---|---|
| committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-13 19:03:37 +0900 |
| commit | 87b68fc2db307fe4e294abd913bcee80ecb9cb7f (patch) | |
| tree | 70f1f534633cb128c780cc1b29ef685fe255798e /pygerrit/models.py | |
| parent | 8571778ed4ebd1ebacba2334d8b6b19fbcd5a2b9 (diff) | |
| parent | ae41ccac316c6bd45ec4af0146219212bbb08c87 (diff) | |
| download | pygerrit-87b68fc2db307fe4e294abd913bcee80ecb9cb7f.tar.gz | |
Merge branch 'master' into internal
* master:
Bump version to 0.1.1
Add changelog
Fix #10: Allow to manually specify ssh username and port
Completely refactor the stream event handling
Add missing __repr__ methods on ErrorEvent and UnhandledEvent
Fix initialisation of error event
Fix #11: correct handling of `identityfile` in the ssh config
Allow example script to continue if errors are received
Fix #9: Add a bit more detail in the documentation
Fix #8: Support the "topic-changed" stream event
Fix #7: Support the "reviewer-added" stream event
Fix #6: Support the "merge-failed" stream event
Fix #5: Move json parsing and error handling into the event factory
Improved logging in the example script
Fix #3: Don't treat unhandled event types as errors
Fix #4: Keep event's raw json data in the event object
Add __repr__ methods on event and model classes
Remove redundant `exec_command` method
Fix #2: Establish SSH connection in a thread-safe way
Fix #1: Use select.select() instead of select.poll()
Change-Id: Ib91384b16acca30bfc5aadcdc1131c8bdecef583
Diffstat (limited to 'pygerrit/models.py')
| -rw-r--r-- | pygerrit/models.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pygerrit/models.py b/pygerrit/models.py index 2e79949..ac9575a 100644 --- a/pygerrit/models.py +++ b/pygerrit/models.py @@ -34,6 +34,10 @@ class Account(object): self.name = from_json(json_data, "name") self.email = from_json(json_data, "email") + def __repr__(self): + return u"<Account %s%s>" % (self.name, + " (%s)" % self.email if self.email else "") + @staticmethod def from_json(json_data, key): """ Create an Account instance. @@ -61,6 +65,9 @@ class Change(object): self.url = from_json(json_data, "url") self.owner = Account.from_json(json_data, "owner") + def __repr__(self): + return u"<Change %s, %s, %s>" % (self.number, self.project, self.branch) + class Patchset(object): @@ -72,6 +79,9 @@ class Patchset(object): self.ref = from_json(json_data, "ref") self.uploader = Account.from_json(json_data, "uploader") + def __repr__(self): + return u"<Patchset %s, %s>" % (self.number, self.revision) + @staticmethod def from_json(json_data): r""" Create a Patchset instance. @@ -94,6 +104,9 @@ class Approval(object): self.value = from_json(json_data, "value") self.description = from_json(json_data, "description") + def __repr__(self): + return u"<Approval %s %s>" % (self.description, self.value) + class RefUpdate(object): @@ -104,3 +117,7 @@ class RefUpdate(object): self.newrev = from_json(json_data, "newRev") self.refname = from_json(json_data, "refName") self.project = from_json(json_data, "project") + + def __repr__(self): + return "<RefUpdate %s %s %s %s>" % \ + (self.project, self.refname, self.oldrev, self.newrev) |
