WrapperInvertor (@NotNull Url repoUrl, @NotNull Url sourceUrl, @NotNull Url targetUrl) { synchronized (myPersistenceLock) { WrapperInvertor result = null; TreeMap<String, BranchCopyData> map = myPersistentMap.get(repoUrl); if (map != null) { BranchCopyData sourceData = getBranchData(map, sourceUrl); BranchCopyData targetData = getBranchData(map, targetUrl); if (sourceData != null && targetData != null) { boolean inverted = sourceData.getTargetRevision() > targetData.getTargetRevision(); result = new WrapperInvertor(inverted, inverted ? sourceData : targetData); } else if (sourceData != null) { result = new WrapperInvertor(true, sourceData); } else if (targetData != null) { result = new WrapperInvertor(false, targetData); } } return result; } }