Map<String, MongoNode> nodes = new HashMap<String, MongoNode>();
Map<Long, MongoCommit> commits = new HashMap<Long, MongoCommit>();
while (dbCursor.hasNext() && (numberOfNodesToFetch == -1 || nodes.size() < numberOfNodesToFetch)) {
MongoNode node = (MongoNode)dbCursor.next();
String path = node.getPath();
// Assuming that revision ids are ordered and nodes are fetched in
// sorted order, first check if the path is already in the map.
if (nodes.containsKey(path)) {
LOG.debug("Converted node @{} with path {} was not put into map"
+ " because a newer version is available", node.getRevisionId(), path);
continue;
} else {
long revisionId = node.getRevisionId();
LOG.debug("Converting node {} (@{})", path, revisionId);
if (!commits.containsKey(revisionId) && nodeStore.getFromCache(revisionId) == null) {
LOG.debug("Fetching commit @{}", revisionId);
FetchCommitAction action = new FetchCommitAction(nodeStore, revisionId);