representation for Ref objects
The ref objects were missing a python __repr__, ended up with a not so useful trace in the debug.log. This creates a meaningful representation for human consumption: <Ref 0x7f51f848ffd0 creates refs/tags/v2.0.0 on 4eb656fe> <Ref 0x7f51f8491990 refs/tags/v2.0.0 updated 4eb656f..2260abb> <Ref 0x7f51f848f610 deletes refs/tags/v2.0.0 from 2260abb> (sha1 above have been made shorter than the actual output) Change-Id: If3b60494f1984a04e9ffada38f7e3b99f2a8ba0e Reviewed-on: https://review.openstack.org/19925 Reviewed-by: James E. Blair <corvus@inaugust.com> Approved: Clark Boylan <clark.boylan@gmail.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Tested-by: Jenkins
This commit is contained in:
parent
8fa1697ea9
commit
68bdcd7f09
|
@ -563,6 +563,21 @@ class Ref(Changeish):
|
|||
def _id(self):
|
||||
return self.newrev
|
||||
|
||||
def __repr__(self):
|
||||
rep = None
|
||||
if self.newrev == '0000000000000000000000000000000000000000':
|
||||
rep = '<Ref 0x%x deletes %s from %s' % (
|
||||
id(self), self.ref, self.oldrev)
|
||||
elif self.oldrev == '0000000000000000000000000000000000000000':
|
||||
rep = '<Ref 0x%x creates %s on %s>' % (
|
||||
id(self), self.ref, self.newrev)
|
||||
else:
|
||||
# Catch all
|
||||
rep = '<Ref 0x%x %s updated %s..%s>' % (
|
||||
id(self), self.ref, self.oldrev, self.newrev)
|
||||
|
||||
return rep
|
||||
|
||||
def equals(self, other):
|
||||
if (self.project == other.project
|
||||
and self.ref == other.ref
|
||||
|
|
Loading…
Reference in New Issue