use of org.jooq.migrations.xml.jaxb.ParentType in project jOOQ by jOOQ.
the class CommitsImpl method load.
private final Commit load(Map<String, CommitType> map, CommitType commit) {
Commit result = commits.get(commit.getId());
if (result != null)
return result;
Commit p1 = root;
Commit p2 = null;
List<ParentType> parents = commit.getParents();
int size = parents.size();
if (size > 0) {
CommitType c1 = map.get(parents.get(0).getId());
if (c1 == null)
throw new UnsupportedOperationException("Parent not found: " + parents.get(0).getId());
p1 = load(map, c1);
if (size == 2) {
CommitType c2 = map.get(parents.get(1).getId());
if (c2 == null)
throw new UnsupportedOperationException("Parent not found: " + parents.get(0).getId());
p2 = load(map, c2);
} else if (size > 2)
throw new UnsupportedOperationException("Merging more than two parents not yet supported");
}
result = p2 == null ? p1.commit(commit.getId(), commit.getMessage(), files(commit)) : p1.merge(commit.getId(), commit.getMessage(), p2, files(commit));
commits.put(commit.getId(), result);
return result;
}
Aggregations