use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnCheckoutProvider method doExport.
public static void doExport(final Project project, final File target, final SVNURL url, final Depth depth, final boolean ignoreExternals, final boolean force, final String eolStyle) {
try {
final VcsException[] exception = new VcsException[1];
final SvnVcs vcs = SvnVcs.getInstance(project);
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
ProgressTracker handler = new CheckoutEventHandler(vcs, true, progressIndicator);
try {
progressIndicator.setText(message("progress.text.export", target.getAbsolutePath()));
SvnTarget from = SvnTarget.fromURL(url);
ExportClient client = vcs.getFactoryFromSettings().createExportClient();
client.export(from, target, SVNRevision.HEAD, depth, eolStyle, force, ignoreExternals, handler);
} catch (VcsException e) {
exception[0] = e;
}
}, message("message.title.export"), true, project);
if (exception[0] != null) {
throw exception[0];
}
} catch (VcsException e1) {
showErrorDialog(message("message.text.cannot.export", e1.getMessage()), message("message.title.export"));
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnCheckoutProvider method doImport.
public static void doImport(final Project project, final File target, final SVNURL url, final Depth depth, final boolean includeIgnored, final String message) {
final Ref<String> errorMessage = new Ref<>();
final SvnVcs vcs = SvnVcs.getInstance(project);
final String targetPath = FileUtil.toSystemIndependentName(target.getAbsolutePath());
ExclusiveBackgroundVcsAction.run(project, () -> ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
final FileIndexFacade facade = PeriodicalTasksCloser.getInstance().safeGetService(project, FileIndexFacade.class);
ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
try {
progressIndicator.setText(message("progress.text.import", target.getAbsolutePath()));
final VirtualFile targetVf = SvnUtil.getVirtualFile(targetPath);
if (targetVf == null) {
errorMessage.set("Can not find file: " + targetPath);
} else {
final boolean isInContent = getApplication().runReadAction((Computable<Boolean>) () -> facade.isInContent(targetVf));
CommitEventHandler handler = new IdeaCommitHandler(progressIndicator);
boolean useFileFilter = !project.isDefault() && isInContent;
ISVNCommitHandler commitHandler = useFileFilter ? new MyFilter(LocalFileSystem.getInstance(), new SvnExcludingIgnoredOperation.Filter(project)) : null;
long revision = vcs.getFactoryFromSettings().createImportClient().doImport(target, url, depth, message, includeIgnored, handler, commitHandler);
if (revision > 0) {
StatusBar.Info.set(message("status.text.comitted.revision", revision), project);
}
}
} catch (VcsException e) {
errorMessage.set(e.getMessage());
}
}, message("message.title.import"), true, project));
if (!errorMessage.isNull()) {
showErrorDialog(message("message.text.cannot.import", errorMessage.get()), message("message.title.import"));
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class ShareWholeProject method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final MyChecker checker = new MyChecker();
checker.execute(e);
if (!checker.isEnabled())
return;
final Project project = checker.getProject();
final VirtualFile baseDir = project.getBaseDir();
if (baseDir == null)
return;
boolean success = false;
boolean excThrown = false;
try {
success = ShareProjectAction.share(project, baseDir);
} catch (VcsException exc) {
AbstractVcsHelper.getInstance(project).showError(exc, "Failed to Share Project");
excThrown = true;
} finally {
// if success = false -> either action was cancelled or exception was thrown, so also check for exception
if (success || excThrown) {
baseDir.refresh(true, true, () -> ApplicationManager.getApplication().invokeLater(() -> {
VcsDirtyScopeManager.getInstance(project).dirDirtyRecursively(project.getBaseDir());
if (checker.isHadNoMappings() && SvnUtil.seemsLikeVersionedDir(baseDir)) {
final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
vcsManager.setDirectoryMappings(Arrays.asList(new VcsDirectoryMapping("", SvnVcs.VCS_NAME)));
}
}, ModalityState.NON_MODAL, project.getDisposed()));
}
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnMergeProvider method conflictResolvedForFile.
public void conflictResolvedForFile(@NotNull VirtualFile file) {
// TODO: Add possibility to resolve content conflicts separately from property conflicts.
SvnVcs vcs = SvnVcs.getInstance(myProject);
File path = virtualToIoFile(file);
try {
// TODO: Probably false should be passed to "resolveTree", but previous logic used true implicitly
vcs.getFactory(path).createConflictClient().resolve(path, Depth.EMPTY, false, true, true);
} catch (VcsException e) {
LOG.warn(e);
}
// the .mine/.r## files have been deleted
final VirtualFile parent = file.getParent();
if (parent != null) {
parent.refresh(true, false);
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnMergeProvider method getBaseRevisionContents.
private ByteArrayOutputStream getBaseRevisionContents(@NotNull SvnVcs vcs, @NotNull VirtualFile file) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
byte[] contents = SvnUtil.getFileContents(vcs, SvnTarget.fromFile(virtualToIoFile(file)), SVNRevision.BASE, SVNRevision.UNDEFINED);
bos.write(contents);
} catch (VcsException | IOException e) {
LOG.warn(e);
}
return bos;
}
Aggregations