use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings 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.ChangeBrowserSettings in project intellij-community by JetBrains.
the class CvsCommittedChangesProvider method loadCommittedChanges.
public void loadCommittedChanges(ChangeBrowserSettings settings, RepositoryLocation location, int maxCount, final AsynchConsumer<CommittedChangeList> consumer) throws VcsException {
try {
final CvsRepositoryLocation cvsLocation = (CvsRepositoryLocation) location;
final String module = cvsLocation.getModuleName();
final CvsEnvironment connectionSettings = cvsLocation.getEnvironment();
if (connectionSettings.isOffline()) {
return;
}
final CvsChangeListsBuilder builder = new CvsChangeListsBuilder(module, connectionSettings, myProject, cvsLocation.getRootFile());
final Date dateTo = settings.getDateBeforeFilter();
Date dateFrom = settings.getDateAfterFilter();
if (dateFrom == null) {
final Calendar calendar = Calendar.getInstance();
calendar.set(1970, Calendar.MARCH, 2);
dateFrom = calendar.getTime();
}
final ChangeBrowserSettings.Filter filter = settings.createFilter();
final Set<CvsChangeList> controlSet = new HashSet<>();
final LoadHistoryOperation operation = new LoadHistoryOperation(connectionSettings, module, dateFrom, dateTo, wrapper -> {
final List<RevisionWrapper> wrappers = builder.revisionWrappersFromLog(wrapper);
if (wrappers != null) {
for (RevisionWrapper revisionWrapper : wrappers) {
final CvsChangeList changeList = builder.addRevision(revisionWrapper);
if (controlSet.contains(changeList))
continue;
controlSet.add(changeList);
if (filter.accepts(changeList)) {
consumer.consume(changeList);
}
}
}
});
final CvsResult executionResult = operation.run(myProject);
if (executionResult.isCanceled()) {
throw new ProcessCanceledException();
} else if (executionResult.hasErrors()) {
throw executionResult.composeError();
}
} finally {
consumer.finished();
}
}
use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings in project intellij-community by JetBrains.
the class SvnCommittedViewTest method testCopyAndModify.
@Test
public void testCopyAndModify() throws Exception {
final File trunk = new File(myTempDirFixture.getTempDirPath(), "trunk");
trunk.mkdir();
Thread.sleep(100);
final File folder = new File(trunk, "folder");
folder.mkdir();
Thread.sleep(100);
new File(folder, "f1.txt").createNewFile();
new File(folder, "f2.txt").createNewFile();
Thread.sleep(100);
runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk");
update();
runInAndVerifyIgnoreOutput("copy", myWorkingCopyDir.getPath() + "/trunk", myWorkingCopyDir.getPath() + "/branch");
runInAndVerifyIgnoreOutput("propset", "testprop", "testval", myWorkingCopyDir.getPath() + "/branch/folder");
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList = committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(), new SvnRepositoryLocation(myRepoUrl + "/branch"), 0);
checkList(changeListList, 2, new Data[] { new Data(new File(myWorkingCopyDir.getPath(), "branch").getAbsolutePath(), FileStatus.ADDED, "- copied from /trunk"), new Data(new File(myWorkingCopyDir.getPath(), "branch/folder").getAbsolutePath(), FileStatus.MODIFIED, "- copied from /trunk/folder") });
}
use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings in project intellij-community by JetBrains.
the class SvnCommittedViewTest method testReplaced.
@Test
public void testReplaced() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");
VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");
// r1, addition without history
checkin();
File dir = virtualToIoFile(d1);
final String d1Path = dir.getAbsolutePath();
runInAndVerifyIgnoreOutput("delete", d1Path);
boolean created = dir.mkdir();
Assert.assertTrue(created);
runInAndVerifyIgnoreOutput("add", d1Path);
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList = committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(), new SvnRepositoryLocation(myRepoUrl), 0);
checkList(changeListList, 2, new Data[] { new Data(absPath(d1), FileStatus.MODIFIED, "- replaced") });
}
use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings 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();
}
}
Aggregations