use of org.jetbrains.idea.svn.SvnVcs in project intellij-community by JetBrains.
the class DefaultBranchConfigInitializer method getDefaultConfiguration.
@Nullable
public SvnBranchConfigurationNew getDefaultConfiguration() {
SvnBranchConfigurationNew result = null;
SvnVcs vcs = SvnVcs.getInstance(myProject);
SVNURL rootUrl = SvnUtil.getUrl(vcs, VfsUtilCore.virtualToIoFile(myRoot));
if (rootUrl != null) {
try {
result = getDefaultConfiguration(vcs, rootUrl);
} catch (SVNException | VcsException e) {
LOG.info(e);
}
} else {
LOG.info("Directory is not a working copy: " + myRoot.getPresentableUrl());
}
return result;
}
use of org.jetbrains.idea.svn.SvnVcs in project intellij-community by JetBrains.
the class NewRootBunch method reloadBranches.
public void reloadBranches(@NotNull VirtualFile root, @Nullable SvnBranchConfigurationNew prev, @NotNull SvnBranchConfigurationNew next) {
final Set<String> oldUrls = (prev == null) ? Collections.emptySet() : new HashSet<>(prev.getBranchUrls());
final SvnVcs vcs = SvnVcs.getInstance(myProject);
if (!vcs.isVcsBackgroundOperationsAllowed(root))
return;
for (String newBranchUrl : next.getBranchUrls()) {
// check if cancel had been put
if (!vcs.isVcsBackgroundOperationsAllowed(root))
return;
if (!oldUrls.contains(newBranchUrl)) {
reloadBranches(root, newBranchUrl, InfoReliability.defaultValues, true);
}
}
}
use of org.jetbrains.idea.svn.SvnVcs in project intellij-community by JetBrains.
the class BasicAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
Project project = e.getProject();
SvnVcs vcs = project != null ? SvnVcs.getInstance(project) : null;
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
boolean visible = project != null;
e.getPresentation().setEnabled(visible && vcs != null && !isEmpty(files) && isEnabled(vcs, files));
e.getPresentation().setVisible(visible);
}
use of org.jetbrains.idea.svn.SvnVcs 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 org.jetbrains.idea.svn.SvnVcs in project intellij-community by JetBrains.
the class CreateExternalAction method doInBackground.
private static void doInBackground(@NotNull Project project, @NotNull VirtualFile file, String url, boolean checkout, String target) {
SvnVcs vcs = SvnVcs.getInstance(project);
VcsDirtyScopeManager dirtyScopeManager = VcsDirtyScopeManager.getInstance(project);
File ioFile = virtualToIoFile(file);
try {
addToExternalProperty(vcs, ioFile, target, url);
dirtyScopeManager.fileDirty(file);
if (checkout) {
UpdateClient client = vcs.getFactory(ioFile).createUpdateClient();
client.setEventHandler(new SvnProgressCanceller());
client.doUpdate(ioFile, SVNRevision.HEAD, Depth.UNKNOWN, false, false);
file.refresh(true, true, () -> dirtyScopeManager.dirDirtyRecursively(file));
}
} catch (VcsException e) {
AbstractVcsHelper.getInstance(project).showError(e, "Create External");
}
}
Aggregations