isUpdateOf check field presence before comparison.

isUpdateOf is passed an "other" changeish that may be a Ref which does
not have number and patchset fields which are compared against in
Change's isUpdateOf method. Check that fields exist before comparisons
are made.

Change-Id: Ifb5a36dcb0377f496e6b0707ae27810b96f2c752
Reviewed-on: https://review.openstack.org/22159
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Clark Boylan 2013-02-17 18:41:48 -08:00 committed by Jenkins
parent dd26978d5d
commit 0197624ef7
1 changed files with 2 additions and 1 deletions

View File

@ -552,7 +552,8 @@ class Change(Changeish):
return False
def isUpdateOf(self, other):
if self.number == other.number and self.patchset > other.patchset:
if ((hasattr(other, 'number') and self.number == other.number) and
(hasattr(other, 'patchset') and self.patchset > other.patchset)):
return True
return False