Don't enqueue changes that are already in the queue.
Change-Id: I6be35d708fc13b5156270f2003d17a4afa856e4f
This commit is contained in:
parent
6173fb3949
commit
0dc8ba922d
|
@ -328,6 +328,19 @@ class Change(object):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Change 0x%x %s>' % (id(self), self._id())
|
return '<Change 0x%x %s>' % (id(self), self._id())
|
||||||
|
|
||||||
|
def equals(self, other):
|
||||||
|
if self.number:
|
||||||
|
if (self.number == other.number and
|
||||||
|
self.patchset == other.patchset):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
if self.ref:
|
||||||
|
if (self.ref == other.ref and
|
||||||
|
self.newrew == other.newrev):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
return False
|
||||||
|
|
||||||
def _filterJobs(self, jobs):
|
def _filterJobs(self, jobs):
|
||||||
return filter(lambda job: job.eventMatches(self.event), jobs)
|
return filter(lambda job: job.eventMatches(self.event), jobs)
|
||||||
|
|
||||||
|
|
|
@ -397,7 +397,16 @@ class BaseQueueManager(object):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def isChangeAlreadyInQueue(self, change):
|
||||||
|
for c in self.getChangesInQueue():
|
||||||
|
if change.equals(c):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def addChange(self, change):
|
def addChange(self, change):
|
||||||
|
if self.isChangeAlreadyInQueue(change):
|
||||||
|
self.log.debug("Change %s is already in queue, ignoring" % change)
|
||||||
|
return
|
||||||
self.log.debug("Adding change %s" % change)
|
self.log.debug("Adding change %s" % change)
|
||||||
if self.start_action:
|
if self.start_action:
|
||||||
try:
|
try:
|
||||||
|
@ -507,11 +516,15 @@ for change %s:" % (job, change))
|
||||||
self.updateBuildDescriptions(change.current_build_set)
|
self.updateBuildDescriptions(change.current_build_set)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def formatStatusHTML(self):
|
def getChangesInQueue(self):
|
||||||
changes = []
|
changes = []
|
||||||
for build, change in self.building_jobs.items():
|
for build, change in self.building_jobs.items():
|
||||||
if change not in changes:
|
if change not in changes:
|
||||||
changes.append(change)
|
changes.append(change)
|
||||||
|
return changes
|
||||||
|
|
||||||
|
def formatStatusHTML(self):
|
||||||
|
changes = self.getChangesInQueue()
|
||||||
ret = ''
|
ret = ''
|
||||||
for change in changes:
|
for change in changes:
|
||||||
ret += change.formatStatus(html=True)
|
ret += change.formatStatus(html=True)
|
||||||
|
@ -571,6 +584,9 @@ class DependentQueueManager(BaseQueueManager):
|
||||||
self.log.error("Unable to find change queue for project %s" % project)
|
self.log.error("Unable to find change queue for project %s" % project)
|
||||||
|
|
||||||
def addChange(self, change):
|
def addChange(self, change):
|
||||||
|
if self.isChangeAlreadyInQueue(change):
|
||||||
|
self.log.debug("Change %s is already in queue, ignoring" % change)
|
||||||
|
return
|
||||||
self.log.debug("Adding change %s" % change)
|
self.log.debug("Adding change %s" % change)
|
||||||
change_queue = self.getQueue(change.project)
|
change_queue = self.getQueue(change.project)
|
||||||
if change_queue:
|
if change_queue:
|
||||||
|
@ -665,6 +681,12 @@ behind failed change %s" % (
|
||||||
possibly reporting" % (change.change_behind, change))
|
possibly reporting" % (change.change_behind, change))
|
||||||
self.possiblyReportChange(change.change_behind)
|
self.possiblyReportChange(change.change_behind)
|
||||||
|
|
||||||
|
def getChangesInQueue(self):
|
||||||
|
changes = []
|
||||||
|
for shared_queue in self.change_queues:
|
||||||
|
changes.extend(shared_queue.queue)
|
||||||
|
return changes
|
||||||
|
|
||||||
def formatStatusHTML(self):
|
def formatStatusHTML(self):
|
||||||
ret = ''
|
ret = ''
|
||||||
ret += '\n'
|
ret += '\n'
|
||||||
|
|
Loading…
Reference in New Issue