[git] fix deep comparator keeping highlighting after branch filter unset

When branch filter is unset, cherri-picked commits should be un-highlighted. But when this happen during refresh, visible pack arrives with both new graph and new filters. So DeepComparator should check filters first.
This commit is contained in:
Julia Beliaeva
2016-11-15 00:31:16 +03:00
parent 67ecbcae6e
commit 43c81ef35d
@@ -139,9 +139,14 @@ public class DeepComparator implements VcsLogHighlighter, Disposable {
return;
}
String comparedBranch = myTask.myComparedBranch;
VcsLogBranchFilter branchFilter = dataPack.getFilters().getBranchFilter();
if (branchFilter == null || !myTask.myComparedBranch.equals(VcsLogUtil.getSingleFilteredBranch(branchFilter, dataPack.getRefs()))) {
stopAndUnhighlight();
return;
}
if (refreshHappened) {
// collect data
String comparedBranch = myTask.myComparedBranch;
Map<GitRepository, GitBranch> repositoriesWithCurrentBranches = myTask.myRepositoriesWithCurrentBranches;
VcsLogDataProvider provider = myTask.myProvider;
@@ -149,14 +154,12 @@ public class DeepComparator implements VcsLogHighlighter, Disposable {
// highlight again
Map<GitRepository, GitBranch> repositories = getRepositories(dataPack.getLogProviders(), comparedBranch);
if (repositories.equals(repositoriesWithCurrentBranches)) { // but not if current branch changed
if (repositories.equals(repositoriesWithCurrentBranches)) {
// but not if current branch changed
highlightInBackground(comparedBranch, provider);
}
}
else {
VcsLogBranchFilter branchFilter = dataPack.getFilters().getBranchFilter();
if (branchFilter == null || !myTask.myComparedBranch.equals(VcsLogUtil.getSingleFilteredBranch(branchFilter, dataPack.getRefs()))) {
stopAndUnhighlight();
else {
removeHighlighting();
}
}
}
@@ -278,6 +281,5 @@ public class DeepComparator implements VcsLogHighlighter, Disposable {
handler.runInCurrentThread(null);
return pickedCommits;
}
}
}