use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class CommittedChangesCache method refreshCache.
// todo: fix - would externally loaded necessarily for file? i.e. just not efficient now
private List<CommittedChangeList> refreshCache(final ChangesCacheFile cacheFile) throws VcsException, IOException {
final List<CommittedChangeList> newLists = new ArrayList<>();
final CachingCommittedChangesProvider provider = cacheFile.getProvider();
final RepositoryLocation location = cacheFile.getLocation();
final Pair<Long, List<CommittedChangeList>> externalLists = myExternallyLoadedChangeLists.get(location.getKey());
final long latestChangeList = getLatestListForFile(cacheFile);
if ((externalLists != null) && (latestChangeList == externalLists.first.longValue())) {
newLists.addAll(appendLoadedChanges(cacheFile, location, externalLists.second));
myExternallyLoadedChangeLists.clear();
}
final ChangeBrowserSettings defaultSettings = provider.createDefaultSettings();
int maxCount = 0;
if (provider.refreshCacheByNumber()) {
final long number = cacheFile.getLastCachedChangelist();
debug("Refreshing cache for " + location + " since #" + number);
if (number >= 0) {
defaultSettings.CHANGE_AFTER = Long.toString(number);
defaultSettings.USE_CHANGE_AFTER_FILTER = true;
} else {
maxCount = myState.getInitialCount();
}
} else {
final Date date = cacheFile.getLastCachedDate();
debug("Refreshing cache for " + location + " since " + date);
defaultSettings.setDateAfter(date);
defaultSettings.USE_DATE_AFTER_FILTER = true;
}
defaultSettings.STRICTLY_AFTER = true;
final List<CommittedChangeList> newChanges = provider.getCommittedChanges(defaultSettings, location, maxCount);
debug("Loaded " + newChanges.size() + " new changelists");
newLists.addAll(appendLoadedChanges(cacheFile, location, newChanges));
return newLists;
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class CommittedChangesTreeBrowser method buildTreeModel.
private TreeModel buildTreeModel(final List<CommittedChangeList> filteredChangeLists) {
DefaultMutableTreeNode root = new DefaultMutableTreeNode();
DefaultTreeModel model = new DefaultTreeModel(root);
Collections.sort(filteredChangeLists, myGroupingStrategy.getComparator());
myGroupingStrategy.beforeStart();
DefaultMutableTreeNode lastGroupNode = null;
String lastGroupName = null;
for (CommittedChangeList list : filteredChangeLists) {
String groupName = StringUtil.notNullize(myGroupingStrategy.getGroupName(list));
if (!Comparing.equal(groupName, lastGroupName)) {
lastGroupName = groupName;
lastGroupNode = new DefaultMutableTreeNode(lastGroupName);
root.add(lastGroupNode);
}
assert lastGroupNode != null;
lastGroupNode.add(new DefaultMutableTreeNode(list));
}
return model;
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class CommittedChangesTreeBrowser method collectChanges.
@NotNull
public static List<Change> collectChanges(final List<? extends CommittedChangeList> selectedChangeLists, final boolean withMovedTrees) {
Collections.sort(selectedChangeLists, CommittedChangeListByDateComparator.ASCENDING);
List<Change> changes = new ArrayList<>();
for (CommittedChangeList cl : selectedChangeLists) {
changes.addAll(withMovedTrees ? cl.getChangesWithMovedTrees() : cl.getChanges());
}
return zipChanges(changes);
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class CommittedChangesTreeBrowser method updateBySelectionChange.
private void updateBySelectionChange() {
List<CommittedChangeList> selection = new ArrayList<>();
final TreePath[] selectionPaths = myChangesTree.getSelectionPaths();
if (selectionPaths != null) {
for (TreePath path : selectionPaths) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
if (node.getUserObject() instanceof CommittedChangeList) {
selection.add((CommittedChangeList) node.getUserObject());
}
}
}
if (!selection.equals(mySelectedChangeLists)) {
mySelectedChangeLists = selection;
myDetailsView.setChangesToDisplay(collectChanges(mySelectedChangeLists, false));
}
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class CommittedListsSequencesZipper method mergeLocationGroupChangeLists.
@NotNull
private List<CommittedChangeList> mergeLocationGroupChangeLists(@NotNull RepositoryLocationGroup group) {
List<CommittedChangeList> result = ContainerUtil.newArrayList();
List<CommittedChangeList> equalLists = ContainerUtil.newArrayList();
CommittedChangeList previousList = null;
for (CommittedChangeList list : Iterables.mergeSorted(collectChangeLists(group.getLocations()), myComparator)) {
if (previousList != null && myComparator.compare(previousList, list) != 0) {
result.add(zip(group, equalLists));
equalLists.clear();
}
equalLists.add(list);
previousList = list;
}
if (!equalLists.isEmpty()) {
result.add(zip(group, equalLists));
}
return result;
}
Aggregations