use of org.jetbrains.idea.svn.api.ClientFactory in project intellij-community by JetBrains.
the class SvnCheckoutProvider method getFactory.
@NotNull
public static ClientFactory getFactory(@NotNull SvnVcs vcs, @NotNull WorkingCopyFormat format) throws VcsException {
ClientFactory settingsFactory = vcs.getFactoryFromSettings();
ClientFactory otherFactory = vcs.getOtherFactory();
List<WorkingCopyFormat> settingsFactoryFormats = settingsFactory.createCheckoutClient().getSupportedFormats();
List<WorkingCopyFormat> otherFactoryFormats = CheckoutFormatFromUserProvider.getOtherFactoryFormats(otherFactory);
return settingsFactoryFormats.contains(format) || !otherFactoryFormats.contains(format) ? settingsFactory : otherFactory;
}
use of org.jetbrains.idea.svn.api.ClientFactory in project intellij-community by JetBrains.
the class CreateExternalAction method addToExternalProperty.
public static void addToExternalProperty(@NotNull SvnVcs vcs, @NotNull File ioFile, String target, String url) throws VcsException {
ClientFactory factory = vcs.getFactory(ioFile);
PropertyValue propertyValue = factory.createPropertyClient().getProperty(SvnTarget.fromFile(ioFile), SvnPropertyKeys.SVN_EXTERNALS, false, SVNRevision.UNDEFINED);
boolean hasExternals = propertyValue != null && !isEmptyOrSpaces(propertyValue.toString());
String newExternals = "";
if (hasExternals) {
String externalsForTarget = parseExternalsProperty(propertyValue.toString()).get(target);
if (externalsForTarget != null) {
throw new VcsException("Selected destination conflicts with existing: " + externalsForTarget);
}
newExternals = propertyValue.toString().trim() + "\n";
}
newExternals += escape(url) + " " + target;
factory.createPropertyClient().setProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, PropertyValue.create(newExternals), Depth.EMPTY, false);
}
use of org.jetbrains.idea.svn.api.ClientFactory in project intellij-community by JetBrains.
the class ShareProjectAction method performImpl.
private static boolean performImpl(@NotNull SvnVcs vcs, @NotNull VirtualFile file) throws VcsException {
ShareDialog shareDialog = new ShareDialog(vcs.getProject(), file.getName());
shareDialog.show();
String parent = shareDialog.getSelectedURL();
if (shareDialog.isOK() && parent != null) {
Ref<Boolean> actionStarted = new Ref<>(Boolean.TRUE);
Exception[] error = new Exception[1];
ShareDialog.ShareTarget shareTarget = shareDialog.getShareTarget();
if (ShareDialog.ShareTarget.useSelected.equals(shareTarget) && !isFolderEmpty(vcs, parent) && YES != showYesNoDialog(vcs.getProject(), "Remote folder \"" + parent + "\" is not empty.\nDo you want to continue sharing?", "Share Directory", getWarningIcon())) {
return false;
}
WorkingCopyFormat format = SvnCheckoutProvider.promptForWCopyFormat(virtualToIoFile(file), vcs.getProject());
actionStarted.set(format != WorkingCopyFormat.UNKNOWN);
// means operation cancelled
if (format == WorkingCopyFormat.UNKNOWN) {
return true;
}
ExclusiveBackgroundVcsAction.run(vcs.getProject(), () -> ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
try {
SvnWorkingCopyFormatHolder.setPresetFormat(format);
SvnTarget checkoutTarget = createFolderStructure(vcs, file, shareTarget, shareDialog.createStandardStructure(), createUrl(parent), shareDialog.getCommitText());
progress(message("share.directory.checkout.back.progress.text", checkoutTarget.getPathOrUrlString()));
ClientFactory factory = SvnCheckoutProvider.getFactory(vcs, format);
factory.createCheckoutClient().checkout(SvnTarget.fromURL(checkoutTarget.getURL()), virtualToIoFile(file), checkoutTarget.getPegRevision(), Depth.INFINITY, false, false, format, null);
addRecursively(vcs, factory, file);
} catch (VcsException e) {
error[0] = e;
} finally {
vcs.invokeRefreshSvnRoots();
SvnWorkingCopyFormatHolder.setPresetFormat(null);
}
}, message("share.directory.title"), true, vcs.getProject()));
if (Boolean.TRUE.equals(actionStarted.get())) {
if (error[0] != null) {
throw new VcsException(error[0].getMessage());
}
showInfoMessage(vcs.getProject(), message("share.directory.info.message", file.getName()), message("share.directory.title"));
}
return true;
}
return false;
}
use of org.jetbrains.idea.svn.api.ClientFactory in project intellij-community by JetBrains.
the class CopiesPanel method getSupportedFormats.
@NotNull
private List<WorkingCopyFormat> getSupportedFormats() {
List<WorkingCopyFormat> result = ContainerUtil.newArrayList();
ClientFactory factory = myVcs.getFactory();
ClientFactory otherFactory = myVcs.getOtherFactory(factory);
try {
result.addAll(factory.createUpgradeClient().getSupportedFormats());
result.addAll(SvnFormatWorker.getOtherFactoryFormats(otherFactory));
} catch (VcsException e) {
LOG.info(e);
}
return result;
}
use of org.jetbrains.idea.svn.api.ClientFactory in project intellij-community by JetBrains.
the class SvnFormatWorker method getFactory.
@NotNull
private ClientFactory getFactory(@NotNull File path, @NotNull WorkingCopyFormat format) throws VcsException {
ClientFactory factory = myVcs.getFactory(path);
ClientFactory otherFactory = myVcs.getOtherFactory(factory);
List<WorkingCopyFormat> factoryFormats = factory.createUpgradeClient().getSupportedFormats();
List<WorkingCopyFormat> otherFactoryFormats = getOtherFactoryFormats(otherFactory);
return factoryFormats.contains(format) || !otherFactoryFormats.contains(format) ? factory : otherFactory;
}
Aggregations