From ed838405844f8e671459f3ea8ca39bf9984d00e8 Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Mon, 13 Mar 2017 16:40:58 +0300 Subject: [PATCH] revert: Patches: find a nearest candidate for update/move. The first priority is location then hash. --- .../src/com/intellij/updater/DiffCalculator.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/updater/src/com/intellij/updater/DiffCalculator.java b/updater/src/com/intellij/updater/DiffCalculator.java index 67ac93111262..a08a663c6025 100644 --- a/updater/src/com/intellij/updater/DiffCalculator.java +++ b/updater/src/com/intellij/updater/DiffCalculator.java @@ -49,13 +49,14 @@ public class DiffCalculator { for (Map.Entry create : toCreate.entrySet()) { if (Digester.isFile(create.getValue())) { - List sameName = byName.get(new File(create.getKey()).getName()); - String source = findBestCandidateForMove(sameName, create.getKey()); - boolean move = false; - List 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 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; }