[vcs-log] do not unnecessary find branchRef by name when there is condition in cache with the same name

This commit is contained in:
Julia Beliaeva
2016-07-19 19:37:50 +03:00
parent fda66a45bd
commit ba6555a7be
@@ -134,11 +134,11 @@ public class ContainingBranchesGetter {
PermanentGraph<Integer> graph = dataPack.getPermanentGraph();
VcsLogRefs refs = dataPack.getRefsModel();
VcsRef branchRef = ContainerUtil.find(refs.getBranches(),
vcsRef -> vcsRef.getRoot().equals(root) && vcsRef.getName().equals(branchName));
if (branchRef == null) return Conditions.alwaysFalse();
ContainedInBranchCondition condition = myConditions.get(root);
if (condition == null || !condition.getBranch().equals(branchName)) {
VcsRef branchRef = ContainerUtil.find(refs.getBranches(),
vcsRef -> vcsRef.getRoot().equals(root) && vcsRef.getName().equals(branchName));
if (branchRef == null) return Conditions.alwaysFalse();
condition = new ContainedInBranchCondition(graph.getContainedInBranchCondition(
Collections.singleton(myLogData.getCommitIndex(branchRef.getCommitHash(), branchRef.getRoot()))), branchName);
myConditions.put(root, condition);