Fix --start with existing cache
It turns out len(changes) is only the correct number of changes to skip the first time through with an empty cache. On subsequent runs it skips way too far ahead in the gerrit changes and thus never gets any new ones. This change keeps track of the number of new changes separately from the length of changes, which seems to make the behavior with a cache work correctly again. Change-Id: I1e3509d2d54b514afba64fedecc6a9f5ca408235
This commit is contained in:
parent
e8566158dd
commit
8984d97d20
@ -128,6 +128,7 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='',
|
||||
|
||||
for project in projects:
|
||||
changes = {}
|
||||
new_count = 0
|
||||
logging.debug('Getting changes for project %s' % project['name'])
|
||||
|
||||
if not only_open and not stable:
|
||||
@ -182,8 +183,8 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='',
|
||||
cmd += ' status:open'
|
||||
if stable:
|
||||
cmd += ' branch:stable/%s' % stable
|
||||
if len(changes):
|
||||
cmd += ' --start %d' % len(changes)
|
||||
if new_count:
|
||||
cmd += ' --start %d' % new_count
|
||||
else:
|
||||
# Get a small set the first time so we can get to checking
|
||||
# againt the cache sooner
|
||||
@ -219,6 +220,7 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='',
|
||||
changes[(new_change['id'],
|
||||
new_change['project'],
|
||||
new_change['branch'])] = new_change
|
||||
new_count += 1
|
||||
if end_of_changes:
|
||||
break
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user