From 94566815b8777704c5e8edf98f79c79ce897f13d Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Tue, 14 Feb 2017 01:39:02 -0800 Subject: [PATCH] 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 --- gertty/sync.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gertty/sync.py b/gertty/sync.py index b7c1136..40d19bd 100644 --- a/gertty/sync.py +++ b/gertty/sync.py @@ -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 '' % (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):