use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class HgBrowseChangesTest method doTest.
private void doTest() throws HgCommandException, VcsException {
CachingCommittedChangesProvider provider = myVcs.getCachingCommittedChangesProvider();
assert provider != null;
//noinspection unchecked
List<CommittedChangeList> revisions = provider.getCommittedChanges(mySettings, new HgRepositoryLocation(myRepository.getUrl(), myRepository), -1);
assertTrue(!revisions.isEmpty());
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class SvnCachingRevisionsTest method createCommittedIterator.
private Iterator<ChangesBunch> createCommittedIterator(final int bunchSize, final List<Long> revisions) {
final List<ChangesBunch> list = new ArrayList<>();
for (int i = revisions.size() - 1; i >= 0; i -= bunchSize) {
final int j = (bunchSize > i) ? -1 : (i - bunchSize);
final List<CommittedChangeList> subList = new ArrayList<>();
for (int k = i; k > j; --k) {
subList.add(createList(revisions.get(k)));
}
list.add(new ChangesBunch(subList, (j != -1)));
if (j == -1) {
break;
}
}
return list.iterator();
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class AbstractVcsHelperImpl method showChangesBrowser.
public void showChangesBrowser(final CommittedChangesProvider provider, final RepositoryLocation location, @Nls String title, Component parent) {
final ChangesBrowserSettingsEditor filterUI = provider.createFilterUI(true);
ChangeBrowserSettings settings = provider.createDefaultSettings();
boolean ok;
if (filterUI != null) {
final CommittedChangesFilterDialog dlg = new CommittedChangesFilterDialog(myProject, filterUI, settings);
dlg.show();
ok = dlg.getExitCode() == DialogWrapper.OK_EXIT_CODE;
settings = dlg.getSettings();
} else {
ok = true;
}
if (ok) {
if (myProject.isDefault() || (ProjectLevelVcsManager.getInstance(myProject).getAllActiveVcss().length == 0) || (!ModalityState.NON_MODAL.equals(ModalityState.current()))) {
final List<CommittedChangeList> versions = new ArrayList<>();
if (parent == null || !parent.isValid()) {
parent = WindowManager.getInstance().suggestParentWindow(myProject);
}
final CommittedChangesTableModel model = new CommittedChangesTableModel(versions, true);
final AsynchronousListsLoader[] task = new AsynchronousListsLoader[1];
final ChangeBrowserSettings finalSettings = settings;
final ChangesBrowserDialog dlg = createChangesBrowserDialog(model, title, filterUI != null, parent, new Consumer<ChangesBrowserDialog>() {
@Override
public void consume(ChangesBrowserDialog changesBrowserDialog) {
task[0] = new AsynchronousListsLoader(myProject, provider, location, finalSettings, changesBrowserDialog);
ProgressManager.getInstance().run(task[0]);
}
});
dlg.startLoading();
dlg.show();
if (task[0] != null) {
task[0].cancel();
final List<VcsException> exceptions = task[0].getExceptions();
if (!exceptions.isEmpty()) {
Messages.showErrorDialog(myProject, VcsBundle.message("browse.changes.error.message", exceptions.get(0).getMessage()), VcsBundle.message("browse.changes.error.title"));
return;
}
if (!task[0].isRevisionsReturned()) {
Messages.showInfoMessage(myProject, VcsBundle.message("browse.changes.nothing.found"), VcsBundle.message("browse.changes.nothing.found.title"));
}
}
} else {
openCommittedChangesTab(provider, location, settings, 0, title);
}
}
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class SvnCommittedChangesProvider method loadCommittedChanges.
@Override
public void loadCommittedChanges(@NotNull ChangeBrowserSettings settings, @NotNull RepositoryLocation location, int maxCount, @NotNull AsynchConsumer<CommittedChangeList> consumer) throws VcsException {
try {
SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
String repositoryRoot = getRepositoryRoot(svnLocation);
ChangeBrowserSettings.Filter filter = settings.createFilter();
Consumer<LogEntry> resultConsumer = logEntry -> {
SvnChangeList list = new SvnChangeList(myVcs, svnLocation, logEntry, repositoryRoot);
if (filter.accepts(list)) {
consumer.consume(list);
}
};
SvnTarget target = SvnTarget.fromURL(svnLocation.toSvnUrl(), createBeforeRevision(settings));
getCommittedChangesImpl(settings, target, maxCount, resultConsumer, false, true);
} finally {
consumer.finished();
}
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class CachedProvider method getEarliestBunchInInterval.
@Nullable
public Fragment getEarliestBunchInInterval(final long earliestRevision, final long oldestRevision, final int desirableSize, final boolean includeYoungest, final boolean includeOldest) throws VcsException {
if ((earliestRevision > getEarliestRevision()) || (earliestRevision == -1)) {
if (myAlreadyReaded == null) {
return null;
}
// just return first
return createFromLoaded(myAlreadyReaded, earliestRevision, oldestRevision, desirableSize, includeYoungest, includeOldest, false);
}
final ChangesBunch loadedBunch = myAlreadyReaded;
final List<CommittedChangeList> list = loadedBunch.getList();
if (list.isEmpty()) {
return null;
}
final long oldest = list.get(list.size() - 1).getNumber();
if ((!includeYoungest) && (oldest == earliestRevision)) {
return packNext(earliestRevision, oldestRevision, desirableSize, includeOldest, loadedBunch.isConsistentWithPrevious());
//} else if ((oldest <= earliestRevision) && (youngest >= earliestRevision)) {
} else if (oldest <= earliestRevision) {
return createFromLoaded(loadedBunch, earliestRevision, oldestRevision, desirableSize, includeYoungest, includeOldest, false);
}
return null;
}
Aggregations