Move driver specific change status field to driver

The 'status' field is a driver specific field and should therefore be
defined and initialized in the driver specific subclass of a change and
not in the 'Change' base class.

Change-Id: I0a20041ae8b9f5e4c359fea86c21d1c5c5cbfaca
This commit is contained in:
Simon Westphahl 2020-09-23 11:01:56 +02:00
parent 83281e3356
commit 784fa6c177
4 changed files with 2 additions and 6 deletions

View File

@ -31,6 +31,7 @@ EMPTY_GIT_REF = '0' * 40 # git sha of all zeros, used during creates/deletes
class GerritChange(Change):
def __init__(self, project):
super(GerritChange, self).__init__(project)
self.status = None
self.approvals = []
def update(self, data, connection):

View File

@ -47,11 +47,6 @@ class PullRequest(Change):
def status(self):
return ["{}:{}:{}".format(*c) for c in self.contexts]
@status.setter
def status(self, value):
# Dummy setter to ignore init to None in base class.
pass
@property
def successful_contexts(self) -> set:
if not self.contexts:

View File

@ -28,6 +28,7 @@ class PullRequest(Change):
self.score = 0
self.files = []
self.tags = []
self.status = None
def __repr__(self):
r = ['<Change 0x%x' % id(self)]

View File

@ -3204,7 +3204,6 @@ class Change(Branch):
self.is_merged = False
self.failed_to_merge = False
self.open = None
self.status = None
self.owner = None
# This may be the commit message, or it may be a cover message