mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[log] IDEA-116399 Fix filter by branch
--branches parameter doesn't work well: the pattern syntax it supports is rather weak, and won't allow to effectively filter by several branches. It also doesn't support filtering by a single branch without blog parameters. Therefore, since we allow to filter only by a single branch in the log UI, assume it in the GitLogProvider, and use the <branch> parameter (`git log origin/master`), which works fine. If we will provide ability to filter by several branches someday (by AND or by OR), we could use the graph capabilities to implement it.
This commit is contained in:
@@ -179,13 +179,13 @@ public class GitLogProvider implements VcsLogProvider {
|
||||
|
||||
List<VcsLogBranchFilter> branchFilters = ContainerUtil.findAll(filters, VcsLogBranchFilter.class);
|
||||
if (!branchFilters.isEmpty()) {
|
||||
String branchFilter = joinFilters(branchFilters, new Function<VcsLogBranchFilter, String>() {
|
||||
@Override
|
||||
public String fun(VcsLogBranchFilter filter) {
|
||||
return filter.getBranchName();
|
||||
}
|
||||
});
|
||||
filterParameters.add(prepareParameter("branches", branchFilter));
|
||||
// git doesn't support filtering by several branches very well (--branches parameter give a weak pattern capabilities)
|
||||
// => by now assuming there is only one branch filter.
|
||||
if (branchFilters.size() > 1) {
|
||||
LOG.warn("More than one branch filter was passed. Using only the first one.");
|
||||
}
|
||||
VcsLogBranchFilter branchFilter = branchFilters.get(0);
|
||||
filterParameters.add(branchFilter.getBranchName());
|
||||
}
|
||||
else {
|
||||
filterParameters.add("--all");
|
||||
|
||||
Reference in New Issue
Block a user