[vcs-log-graph] use Logger#assertTrue instead of assert

GitOrigin-RevId: 4848405b06093749ead2bd62c0495ef7cf93b3e0
This commit is contained in:
Julia Beliaeva
2024-03-10 01:19:53 +01:00
committed by intellij-monorepo-bot
parent 256330a8a5
commit 17d30e0697
4 changed files with 15 additions and 6 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.vcs.log.graph.impl.facade.bek;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.vcs.log.graph.api.LinearGraph;
import com.intellij.vcs.log.graph.utils.TimestampGetter;
import org.jetbrains.annotations.NotNull;
@@ -25,6 +26,7 @@ import java.util.List;
import static com.intellij.vcs.log.graph.utils.LinearGraphUtils.getDownNodes;
class BekBranch {
private final static Logger LOG = Logger.getInstance(BekBranch.class);
private static final int MAX_BLOCK_SIZE = 20;
private static final int MAX_DELTA_TIME = 60 * 60 * 24 * 3 * 1000;
@@ -45,7 +47,7 @@ class BekBranch {
}
public void updatePrepareForInsertPart(@NotNull TimestampGetter timestampGetter, @NotNull BekEdgeRestrictions edgeRestrictions) {
assert myPrepareForInsertPart == null;
LOG.assertTrue(myPrepareForInsertPart == null);
int currentNode = myNodeIndexes.get(myNoInsertSize - 1);
if (edgeRestrictions.hasRestriction(currentNode)) return;
@@ -83,7 +85,7 @@ class BekBranch {
}
public void doneInsertPreparedPart() {
assert myPrepareForInsertPart != null;
LOG.assertTrue(myPrepareForInsertPart != null);
myNoInsertSize -= myPrepareForInsertPart.size();
myPrepareForInsertPart = null;
}
@@ -1,6 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.vcs.log.graph.impl.facade.bek;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Pair;
import com.intellij.vcs.log.graph.api.LinearGraph;
import com.intellij.vcs.log.graph.impl.permanent.GraphLayoutImpl;
@@ -17,6 +18,7 @@ import static com.intellij.vcs.log.graph.utils.LinearGraphUtils.getDownNodes;
import static com.intellij.vcs.log.graph.utils.LinearGraphUtils.getUpNodes;
class BekBranchCreator {
private final static Logger LOG = Logger.getInstance(BekBranchCreator.class);
@NotNull private final LinearGraph myPermanentGraph;
@NotNull private final GraphLayoutImpl myGraphLayout;
@NotNull private final Flags myDoneNodes;
@@ -43,7 +45,7 @@ class BekBranchCreator {
public List<Integer> createNextBranch(int headNode) {
final List<Integer> nodeIndexes = new ArrayList<>();
assert !myDoneNodes.get(headNode);
LOG.assertTrue(!myDoneNodes.get(headNode));
myDoneNodes.set(headNode, true);
nodeIndexes.add(headNode);
@@ -1,6 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.vcs.log.graph.impl.facade.bek;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.graph.utils.TimestampGetter;
import org.jetbrains.annotations.NotNull;
@@ -9,6 +10,7 @@ import java.util.ArrayList;
import java.util.List;
class BekBranchMerger {
private final static Logger LOG = Logger.getInstance(BekBranchMerger.class);
@NotNull private final List<? extends BekBranch> myBekBranches;
@NotNull private final BekEdgeRestrictions myEdgeRestrictions;
@NotNull private final TimestampGetter myTimestampGetter;
@@ -41,7 +43,7 @@ class BekBranchMerger {
List<Integer> prepareForInsertPart = bekBranch.getPrepareForInsertPart();
if (prepareForInsertPart == null) return Long.MAX_VALUE;
assert !prepareForInsertPart.isEmpty();
LOG.assertTrue(!prepareForInsertPart.isEmpty());
int nodeIndex = prepareForInsertPart.get(0);
return myTimestampGetter.getTimestamp(nodeIndex);
}
@@ -55,7 +57,7 @@ class BekBranchMerger {
}
List<Integer> prepareForInsertPart = selectBranch.getPrepareForInsertPart();
assert prepareForInsertPart != null;
LOG.assertTrue(prepareForInsertPart != null);
for (int insertedNode : prepareForInsertPart) {
myEdgeRestrictions.removeRestriction(insertedNode);
}
@@ -1,6 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.vcs.log.graph.impl.facade.bek;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Pair;
import com.intellij.vcs.log.graph.api.LinearGraph;
import com.intellij.vcs.log.graph.impl.permanent.GraphLayoutImpl;
@@ -12,6 +13,8 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
public final class BekSorter {
private final static Logger LOG = Logger.getInstance(BekSorter.class);
@NotNull
public static BekIntMap createBekMap(@NotNull LinearGraph permanentGraph,
@NotNull GraphLayoutImpl graphLayout,
@@ -19,7 +22,7 @@ public final class BekSorter {
BekSorter bekSorter = new BekSorter(permanentGraph, graphLayout, timestampGetter);
List<Integer> result = bekSorter.getResult();
assert result.size() == permanentGraph.nodesCount();
LOG.assertTrue(result.size() == permanentGraph.nodesCount());
return createBekIntMap(result);
}