Merge "Ignore errors during ScanNoteDb"

This commit is contained in:
Dave Borowitz
2016-06-16 13:32:44 +00:00
committed by Gerrit Code Review

View File

@@ -343,8 +343,24 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
Project.NameKey project) throws OrmException, IOException {
Set<Change.Id> ids = scan(repo);
List<ChangeNotes> changeNotes = new ArrayList<>(ids.size());
db = unwrap(db);
for (Change.Id id : ids) {
changeNotes.add(create(db, project, id));
Change change = db.changes().get(id);
if (change == null) {
log.warn("skipping change {} found in project {} " +
"but not in ReviewDb",
id, project);
continue;
} else if (!change.getProject().equals(project)) {
log.error(
"skipping change {} found in project {} " +
"because ReviewDb change has project {}",
id, project, change.getProject());
continue;
}
log.debug("adding change {} found in project {}", id, project);
changeNotes.add(new ChangeNotes(args, change).load());
}
return changeNotes;
}