From da0178b2dab5ccb5afb98d264a0f67af8a319bd8 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sun, 8 Nov 2015 15:23:40 -0800 Subject: [PATCH] Fix syncing changes with comments on a missing file If a change has comments on a file that is not in a patchset, Gertty will fail to sync the change because local db entries for files are only created if the file is actually in the revision. If a comment appears for an unknown file, create an entry in the db for that file. Note, this will cause the change to appear in "file:" queries that match that file. It's not clear to me that is incorrect. Change-Id: I4916b85a5cbd72ced6682448b774752f3f6cc821 --- gertty/sync.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gertty/sync.py b/gertty/sync.py index 96a0fba..44f79af 100644 --- a/gertty/sync.py +++ b/gertty/sync.py @@ -653,6 +653,8 @@ class SyncChangeTask(Task): if remote_comment.get('side', '') == 'PARENT': parent = True fileobj = revision.getFile(remote_file) + if fileobj is None: + fileobj = revision.createFile(remote_file, 'M') comment = fileobj.createComment(remote_comment['id'], account, remote_comment.get('in_reply_to'), created,