Set force_fetch=True on --fetch-missing-refs

This sets force_fetch to True on the SyncChangeTask
when --fetch-missing-refs is passed to the app.
Without this, there doesn't seem to be a way to force
gertty to get the repo back into sync without opening
each change individually.

Change-Id: I9021fda5ea6b978d6930deea776cb4a10a4586d5
This commit is contained in:
Kevin Benton 2017-02-14 01:39:02 -08:00
parent 94e029ec20
commit 94566815b8
1 changed files with 11 additions and 4 deletions

View File

@ -898,16 +898,21 @@ class CheckReposTask(Task):
except gitrepo.GitCloneError:
missing = True
if missing or app.fetch_missing_refs:
sync.submitTask(CheckRevisionsTask(project.key,
priority=LOW_PRIORITY))
sync.submitTask(
CheckRevisionsTask(project.key,
force_fetch=app.fetch_missing_refs,
priority=LOW_PRIORITY)
)
except Exception:
self.log.exception("Exception checking repo %s" %
(project.name,))
class CheckRevisionsTask(Task):
def __init__(self, project_key, priority=NORMAL_PRIORITY):
def __init__(self, project_key, force_fetch=False,
priority=NORMAL_PRIORITY):
super(CheckRevisionsTask, self).__init__(priority)
self.project_key = project_key
self.force_fetch = force_fetch
def __repr__(self):
return '<CheckRevisionsTask %s>' % (self.project_key,)
@ -937,7 +942,9 @@ class CheckRevisionsTask(Task):
else:
to_sync.add(change.id)
for change_id in to_sync:
sync.submitTask(SyncChangeTask(change_id, priority=self.priority))
sync.submitTask(SyncChangeTask(change_id,
force_fetch=self.force_fetch,
priority=self.priority))
class UploadReviewsTask(Task):
def __repr__(self):