use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnEditFileProvider method editFiles.
public void editFiles(VirtualFile[] files) throws VcsException {
File[] ioFiles = new File[files.length];
for (int i = 0; i < files.length; i++) {
ioFiles[i] = virtualToIoFile(files[i]);
PropertyClient client = myVCS.getFactory(ioFiles[i]).createPropertyClient();
PropertyValue property = client.getProperty(SvnTarget.fromFile(ioFiles[i], SVNRevision.WORKING), SvnPropertyKeys.SVN_NEEDS_LOCK, false, SVNRevision.WORKING);
if (property == null) {
throw new VcsException(SvnBundle.message("exception.text.file.miss.svn", ioFiles[i].getName()));
}
}
SvnUtil.doLockFiles(myVCS.getProject(), myVCS, ioFiles);
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnChangelistListener method addToChangeList.
private void addToChangeList(@NotNull String changeList, @NotNull Collection<Change> changes, @Nullable String[] changeListsToOperate) {
for (FilePath path : getPathsFromChanges(changes)) {
try {
File file = path.getIOFile();
myVcs.getFactory(file).createChangeListClient().add(changeList, file, changeListsToOperate);
} catch (VcsException e) {
LOG.info(e);
}
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class BasicAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (isEmpty(files))
return;
SvnVcs vcs = SvnVcs.getInstance(project);
if (!ProjectLevelVcsManager.getInstance(project).checkAllFilesAreUnder(vcs, files))
return;
project.save();
String actionName = getActionName();
LocalHistoryAction action = LocalHistory.getInstance().startAction(actionName);
AbstractVcsHelper helper = AbstractVcsHelper.getInstance(project);
try {
List<VcsException> exceptions = helper.runTransactionRunnable(vcs, exceptionList -> {
VirtualFile badFile = null;
try {
if (isBatchAction()) {
batchExecute(vcs, files, e.getDataContext());
} else {
for (VirtualFile file : files) {
badFile = file;
execute(vcs, file, e.getDataContext());
}
}
} catch (VcsException ex) {
ex.setVirtualFile(badFile);
exceptionList.add(ex);
}
}, null);
helper.showErrors(exceptions, actionName);
} finally {
action.finish();
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class CleanupWorker method run.
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(true);
for (VirtualFile root : myRoots) {
try {
File path = virtualToIoFile(root);
File pathOrParent = virtualToIoFile(root.isDirectory() ? root : root.getParent());
indicator.setText(message("action.Subversion.cleanup.progress.text", path));
myVcs.getFactory(path).createCleanupClient().cleanup(pathOrParent, new SvnProgressCanceller(indicator));
} catch (VcsException e) {
myExceptions.add(Pair.create(e, root));
}
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class CleanupWorker method onSuccess.
@Override
public void onSuccess() {
if (myProject.isDisposed())
return;
getApplication().invokeLater(() -> getApplication().runWriteAction(() -> {
if (!myProject.isDisposed()) {
LocalFileSystem.getInstance().refreshFiles(myRoots, false, true, null);
}
}));
markFilesDirty(myProject, myRoots);
if (!myExceptions.isEmpty()) {
AbstractVcsHelper.getInstance(myProject).showErrors(myExceptions.stream().map(pair -> new VcsException(message("action.Subversion.cleanup.error.message", toSystemDependentName(pair.second.getPath()), pair.first == null ? "" : pair.first.getMessage()))).collect(toList()), myTitle);
}
}
Aggregations