public RepositoryVisitor(final Path projectPath,
final String _projectRoot,
final boolean cleanTempDir) {
this.root = makeTempRootDirectory(_projectRoot,
cleanTempDir);
try {
if (_projectRoot != null && !_projectRoot.equals("")) {
loadIndex(root.getAbsolutePath());
}
visitPaths(root,
Files.newDirectoryStream(projectPath));
if (oldIdentityHash != null) {
MapDifference<String, String> difference = Maps.difference(oldIdentityHash,
identityHash);
Map<String, String> deletedFiles = difference.entriesOnlyOnLeft();
for (String path : deletedFiles.keySet()) {
boolean deleted = new File(root.getAbsolutePath().replace(projectPath.toString(),
"") + "/" + path).delete();
System.out.println("Deleted: " + root.getAbsolutePath().replace(projectPath.toString(),
"") + "/" + path + " -> " + deleted);
}
}
storeIndex(root.getAbsolutePath());
} catch (IOException | NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
}
}