revert: Patches: find a nearest candidate for update/move. The first priority is location then hash.

This commit is contained in:
Vladimir.Orlov
2017-03-13 16:40:58 +03:00
parent 6d88d9439b
commit ed83840584
@@ -49,13 +49,14 @@ public class DiffCalculator {
for (Map.Entry<String, Long> create : toCreate.entrySet()) {
if (Digester.isFile(create.getValue())) {
List<String> sameName = byName.get(new File(create.getKey()).getName());
String source = findBestCandidateForMove(sameName, create.getKey());
boolean move = false;
List<String> sameContent = byContent.get(create.getValue());
if (source != null && source.equals(findBestCandidateForMove(sameContent, create.getKey()))) {
move = true;
String source = findBestCandidateForMove(sameContent, create.getKey());
boolean move = true;
if (source == null) {
List<String> sameName = byName.get(new File(create.getKey()).getName());
source = findBestCandidateForMove(sameName, create.getKey());
move = false;
}
if (source != null && !critical.contains(source)) {
@@ -99,8 +100,8 @@ public class DiffCalculator {
if (i + 1 > common) {
best = other;
common = i + 1;
// check root folders of candidates with the same matches
}
// check root folders of candidates with the same matches
else if (i + 1 == common && compareRootFolders(dirs, best.split("/")) < compareRootFolders(dirs, other.split("/"))) {
best = other;
}