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
This commit is contained in:
James E. Blair 2015-11-08 15:23:40 -08:00
parent 3b2b671ce4
commit da0178b2da
1 changed files with 2 additions and 0 deletions

View File

@ -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,